Closed weekdaycare closed 2 months ago
使用 getRecentComment 获取最新评论时调用 commentText 时,当用户评论 <a href="...">...</a> 等其他由代码块包裹住的 HTML 元素时,函数只会去掉 <code></code> 标签使得 commentText 变成含有html代码纯文本格式,不知能否优化一下相关逻辑,或者使其输出转义后的字符?
<a href="...">...</a>
<code></code>
commentText 是文本格式的评论内容,如果需要插入到 html,需要自行转义或者去掉标签的。参考 butterfly 主题的做法:
https://github.com/jerryc127/hexo-theme-butterfly/blob/dev/layout/includes/third-party/newest-comments/twikoo-comment.pug#L9C24-L9C47
.replace(/<[^>]+>/g,"")
好的👌
使用 getRecentComment 获取最新评论时调用 commentText 时,当用户评论
<a href="...">...</a>
等其他由代码块包裹住的 HTML 元素时,函数只会去掉<code></code>
标签使得 commentText 变成含有html代码纯文本格式,不知能否优化一下相关逻辑,或者使其输出转义后的字符?