fix: cherry_markdown error (#908)

* fix: first open document, cherryMarkdown not have theme

* fix: modify prismjs style and improve image clarity

* update cherry-markdown

* optimiztion: cherry-markdown

* feat: cherry-markdown add auto-save and update icon

* fix: the mobile phone displays abnormally and Markdown does not allow conversion

---------

Co-authored-by: zhangsheng.93 <zhangsheng.93@bytedance.com>
This commit is contained in:
张胜
2023-11-20 17:31:45 +08:00
committed by GitHub
parent 18b6ead94d
commit 77fccc637a
6 changed files with 22 additions and 8 deletions

View File

@@ -34,7 +34,7 @@ func StripTags(s string) string {
return src
}
//自动提取文章摘要
// 自动提取文章摘要
func AutoSummary(body string, l int) string {
//匹配图片,如果图片语法是在代码块中,这里同样会处理
@@ -60,7 +60,7 @@ func AutoSummary(body string, l int) string {
return content
}
//安全处理HTML文档过滤危险标签和属性.
// 安全处理HTML文档过滤危险标签和属性.
func SafetyProcessor(html string) string {
//安全过滤,移除危险标签和属性
@@ -117,6 +117,8 @@ func SafetyProcessor(html string) string {
if selector := docQuery.Find("div.markdown-article").First(); selector.Size() <= 0 {
if selector := docQuery.Find("div.markdown-toc").First(); selector.Size() > 0 {
docQuery.Find("div.markdown-toc").NextAll().WrapAllHtml("<div class=\"markdown-article\"></div>")
} else if selector := docQuery.Find("dir.toc").First(); selector.Size() > 0 {
docQuery.Find("dir.toc").NextAll().WrapAllHtml("<div class=\"markdown-article\"></div>")
}
}