Skip to content
Snippets Groups Projects
Commit 52e1fcea authored by Frank Duncan's avatar Frank Duncan
Browse files

Add markdown_to_html jinja variable

This is needed for raw views who want to convert markdown right to html
to put in output.
parent 06fdb975
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ phonenumbers = "*"
python-dateutil = "*"
django-unused-media = "*"
pymemcache = "*"
markdown = "*"
[requires]
python_version = "3.11"
......@@ -3,6 +3,7 @@ import os
import csv
import json
import re
import markdown
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
......@@ -63,6 +64,12 @@ def convert_md_to_mwiki(markdown):
else:
return ""
def convert_md_to_html(md):
if md:
return markdown.markdown(md)
else:
return ""
def debug_it(x):
import pprint
pprint.PrettyPrinter(indent=2, width=240).pprint(x)
......@@ -175,6 +182,7 @@ TORQUE_EDIT_PROCESSOR=convert_md_to_mwiki
TORQUE_JINJA_GLOBALS={
"convert_md_to_mwiki": convert_md_to_mwiki,
"convert_md_to_html": convert_md_to_html,
"commaize_number": commaize_number,
"subject_area_table": subject_area_table,
"employees_table": employees_table,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment