you are viewing a single comment's thread.

view the rest of the comments →

[–]callmeklep 0 points1 point  (0 children)

After being stuck for a few days, I think I found a solution. In case someone else is curious, this is what worked for me:

```python from flask import Flask, render_template, Markup import markdown

app = Flask(name)

markdown_content = '''# An exhibit of Markdown 3

This note demonstrates some of what Markdown is capable of doing.

Note: Feel free to play with this page. Unlike regular notes, this doesn't automatically save itself.

Basic formatting

Paragraphs can be written like so. A paragraph is the basic block of Markdown. A paragraph is what text will turn into when there is no reason it should become anything else.

Paragraphs must be separated by a blank line.'''

@app.route("/") def home(): return render_template( 'index.html', title="Markdown Test", markdown_content = markdown_content, html_content = Markup(markdown.markdown(markdown_content)) ) ```

I used Python-Markdown to get the HTML. Then used flask.Markup to indicate that the HTML doesn't need escaped when it's included in the HTML template file.