diff --git a/mdlive.py b/mdlive.py index 5d520fa..3963cfc 100755 --- a/mdlive.py +++ b/mdlive.py @@ -5,7 +5,6 @@ import subprocess import shlex app = Flask(__name__, static_url_path='') -command = shlex.split('/usr/bin/pandoc -f markdown+footnotes+inline_notes+auto_identifiers -t html5 --smart --email-obfuscation=references') @app.route("/") def index(): @@ -16,9 +15,12 @@ def parse(): if request.method == 'GET': return redirect(url_for('index')) data = request.form['markdown'] - proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True) + proc = subprocess.Popen(app.config['COMMAND'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True) return proc.communicate(input=data) if __name__ == "__main__": - app.debug = False - app.run() + app.config['HOST'] = 'localhost' + app.config['PORT'] = 5000 + app.config.from_object('mdlive.default_configuration') + app.config['COMMAND'] = shlex.split(app.config['PARSER']) + app.run(host=app.config['HOST'], port=app.config['PORT']) diff --git a/mdlive/__init__.py b/mdlive/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mdlive/default_configuration.py b/mdlive/default_configuration.py new file mode 100644 index 0000000..d355f28 --- /dev/null +++ b/mdlive/default_configuration.py @@ -0,0 +1,5 @@ +PARSER = '/usr/bin/pandoc -f markdown+footnotes+inline_notes+auto_identifiers -t html5 --smart --email-obfuscation=references' +HOST = '127.0.0.1' +PORT = 5000 +DEBUG = True +CSS = 'blog.css' diff --git a/static/blog.css b/static/blog.css new file mode 100644 index 0000000..879f864 --- /dev/null +++ b/static/blog.css @@ -0,0 +1,28 @@ +@import url('https://ludikovsky.name/fonts/fonts.css'); + +article > footer { + text-align: right; + color: #777; + font-variant: small-caps; + font-size: 11pt; +} + +article > div { + font-size: 14pt; + font-family: 'DejaVu Serif', sans-serif +} + +blockquote { + border-left-color: #777; +} + +code { + font-family: 'Hack', monospace; +} + +body { + text-rendering: optimizeLegibility; + font-variant-ligatures: common-ligatures; + font-kerning: normal; + font-family: 'DejaVu Sans', sans-serif; +} diff --git a/static/index.html b/static/index.html index 5471f38..058345f 100644 --- a/static/index.html +++ b/static/index.html @@ -6,18 +6,8 @@ - - + +
diff --git a/static/mdlive.css b/static/mdlive.css new file mode 100644 index 0000000..5aae6dc --- /dev/null +++ b/static/mdlive.css @@ -0,0 +1,10 @@ +textarea#markdown { + width: 100%; + height: 800px; + font-family: Hack, monospace; +} +div.container > #output { + height: 800px; + overflow-y: scroll; +} +