diff --git a/README.md b/README.md index 664bc74..c5d7004 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,9 @@ docs, but these are some you might care to know about: (and write it to a file in `INSTANCE_PATH`) if one doesn't exist. * `SILICON_EDITOR`: When set to `textarea`, this disables the CodeMirror text editor when editing pages and uses a standard textarea element instead. +* `MD_HARD_WRAP`: When set to `true`, all line breaks are converted to `
` + tags. By default, you must suffix a line with two spaces (` `) to get a + `
`. To initialize the database after the configuration settings have been set, run the following command. It will create an `instance` directory in the root diff --git a/silicon/render_md.py b/silicon/render_md.py index 154b28b..5714033 100644 --- a/silicon/render_md.py +++ b/silicon/render_md.py @@ -1,3 +1,4 @@ +import os from flask import url_for from mistune import create_markdown, HTMLRenderer from mistune.util import safe_entity @@ -111,6 +112,7 @@ def md_renderer(text): """Render a Markdown document into HTML.""" markdown = create_markdown( + hard_wrap=(os.getenv('MD_HARD_WRAP') or "").lower() == "true", renderer=CustomRenderer(escape=False), plugins=[ 'strikethrough',