Skip to content

Commit 70beffe

Browse files
committed
一些小优化
1 parent ca320b0 commit 70beffe

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

blog/templatetags/blog_tags.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def datetimeformat(data):
5151
@register.filter()
5252
@stringfilter
5353
def custom_markdown(content):
54+
"""
55+
通用markdown过滤器,应用文章内容插件
56+
主要用于文章内容处理
57+
"""
5458
html_content = CommonMarkdown.get_markdown(content)
5559

5660
# 然后应用插件过滤器优化HTML
@@ -61,6 +65,13 @@ def custom_markdown(content):
6165
return mark_safe(optimized_html)
6266

6367

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+
6475
@register.simple_tag(takes_context=True)
6576
def render_article_content(context, article, is_summary=False):
6677
"""

plugins/reading_time/plugin.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
'''
2+
Author: liangliangyy [email protected]
3+
Date: 2025-07-07 19:29:12
4+
LastEditors: liangliangyy [email protected]
5+
LastEditTime: 2025-09-29 13:34:49
6+
FilePath: \DjangoBlog\plugins\reading_time\plugin.py
7+
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8+
'''
19
import math
210
import re
311
from djangoblog.plugin_manage.base_plugin import BasePlugin

templates/blog/tags/sidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<aside class="widget_text widget widget_custom_html"><p class="widget-title">
1717
{{ sidebar.name }}</p>
1818
<div class="textwidget custom-html-widget">
19-
{{ sidebar.content|custom_markdown|safe }}
19+
{{ sidebar.content|sidebar_markdown|safe }}
2020
</div>
2121
</aside>
2222
{% endfor %}

0 commit comments

Comments
 (0)