File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ def datetimeformat(data):
51
51
@register .filter ()
52
52
@stringfilter
53
53
def custom_markdown (content ):
54
+ """
55
+ 通用markdown过滤器,应用文章内容插件
56
+ 主要用于文章内容处理
57
+ """
54
58
html_content = CommonMarkdown .get_markdown (content )
55
59
56
60
# 然后应用插件过滤器优化HTML
@@ -61,6 +65,13 @@ def custom_markdown(content):
61
65
return mark_safe (optimized_html )
62
66
63
67
68
+ @register .filter ()
69
+ @stringfilter
70
+ def sidebar_markdown (content ):
71
+ html_content = CommonMarkdown .get_markdown (content )
72
+ return mark_safe (html_content )
73
+
74
+
64
75
@register .simple_tag (takes_context = True )
65
76
def render_article_content (context , article , is_summary = False ):
66
77
"""
Original file line number Diff line number Diff line change 16
16
< aside class ="widget_text widget widget_custom_html "> < p class ="widget-title ">
17
17
{{ sidebar.name }}</ p >
18
18
< div class ="textwidget custom-html-widget ">
19
- {{ sidebar.content|custom_markdown |safe }}
19
+ {{ sidebar.content|sidebar_markdown |safe }}
20
20
</ div >
21
21
</ aside >
22
22
{% endfor %}
You can’t perform that action at this time.
0 commit comments