Browse Source

fix: Exclude commented headers from page contents tree

NGPixel 8 năm trước cách đây
mục cha
commit
25c105cdc2
1 tập tin đã thay đổi với 1 bổ sung0 xóa
  1. 1 0
      server/libs/markdown.js

+ 1 - 0
server/libs/markdown.js

@@ -94,6 +94,7 @@ const videoRules = [
  * @return     {Array}             TOC tree
  * @return     {Array}             TOC tree
  */
  */
 const parseTree = (content) => {
 const parseTree = (content) => {
+  content = content.replace(/<!--(.|\t|\n|\r)*?-->/g, '')
   let tokens = md().parse(content, {})
   let tokens = md().parse(content, {})
   let tocArray = []
   let tocArray = []