diff options
-rw-r--r-- | apioforum/mdrender.py | 17 | ||||
-rw-r--r-- | apioforum/static/style.css | 9 | ||||
-rw-r--r-- | apioforum/templates/common.html | 2 |
3 files changed, 24 insertions, 4 deletions
diff --git a/apioforum/mdrender.py b/apioforum/mdrender.py index 5f1192b..7dbbf6b 100644 --- a/apioforum/mdrender.py +++ b/apioforum/mdrender.py @@ -14,7 +14,11 @@ allowed_tags = [ 'mark', 'img', 'marquee', - 'pulsate' + 'pulsate', + 'sup','sub', + 'table','thead','tbody','tr','th','td', + 'details','summary', + ] allowed_tags += csscolors @@ -22,7 +26,9 @@ allowed_tags += ("mark" + c for c in csscolors) allowed_attributes = bleach.sanitizer.ALLOWED_ATTRIBUTES.copy() allowed_attributes.update( - img='src' + img=['src','alt','title'], + ol=['start'], + details=['open'], ) allowed_tags.extend(bleach.sanitizer.ALLOWED_TAGS) @@ -30,7 +36,12 @@ allowed_tags.extend(bleach.sanitizer.ALLOWED_TAGS) cleaner = bleach.sanitizer.Cleaner(tags=allowed_tags,attributes=allowed_attributes) import markdown -md = markdown.Markdown(extensions=['pymdownx.tilde','fenced_code']) +md = markdown.Markdown(extensions=[ + 'pymdownx.tilde', + 'fenced_code', + 'tables', + 'pymdownx.details', +]) def render(text): text = md.reset().convert(text) diff --git a/apioforum/static/style.css b/apioforum/static/style.css index bb57513..3815860 100644 --- a/apioforum/static/style.css +++ b/apioforum/static/style.css @@ -205,3 +205,12 @@ blockquote { padding: 1px 3px; border: 1px solid black; } + +.md table { + border: 1px solid grey; + border-collapse: collapse; +} +.md table td,.md table th { + border: 1px solid grey; + padding: 4px; +} diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html index 9301a49..ff20644 100644 --- a/apioforum/templates/common.html +++ b/apioforum/templates/common.html @@ -26,7 +26,7 @@ <a class="post-anchor-link" href="{{post_url(post)}}">#{{post.id}}</a> </span> </div> - <div class="post-content"> + <div class="post-content md"> {{ post.content|md|safe }} </div> </div> |