Browse Source

[markdown-it] support markdown-it-mark for mark ==

Le Tan 1 year ago
parent
commit
743e63edbf

+ 1 - 0
src/data/core/vnotex.json

@@ -325,6 +325,7 @@
                             "web/js/markdown-it/markdownItAnchor.umd.js",
                             "web/js/markdown-it/markdownItTocDoneRight.umd.js",
                             "web/js/markdown-it/markdown-it-implicit-figure.js",
+                            "web/js/markdown-it/markdown-it-mark.min.js",
                             "web/js/markdownit.js"
                         ],
                         "styles" : [

+ 5 - 0
src/data/extra/docs/en/markdown_guide.md

@@ -213,6 +213,11 @@ This is the 1^st^ superscript.
 This is the H~2~O subscript.
 ```
 
+### Mark
+```md
+Let's mark the ==word==.
+```
+
 ### Alert
 ```md
 ::: alert-info

+ 5 - 0
src/data/extra/docs/zh_CN/markdown_guide.md

@@ -213,6 +213,11 @@ This is the 1^st^ superscript.
 This is the H~2~O subscript.
 ```
 
+### 标记
+```md
+Let's mark the ==word==.
+```
+
 ### 警告
 ```md
 ::: alert-info

+ 1 - 0
src/data/extra/extra.qrc

@@ -49,6 +49,7 @@
         <file>web/js/markdown-it/markdown-it-sup.min.js</file>
         <file>web/js/markdown-it/markdown-it-task-lists.js</file>
         <file>web/js/markdown-it/markdown-it-texmath.js</file>
+        <file>web/js/markdown-it/markdown-it-mark.min.js</file>
         <file>web/js/markdown-it/markdown-it-inject-linenumbers.js</file>
         <file>web/js/markdown-it/markdown-it-xss.min.js</file>
         <file>web/js/markdown-it/markdown-it-implicit-figure.js</file>

+ 3 - 0
src/data/extra/web/js/markdown-it/README.md

@@ -47,3 +47,6 @@ v4.2.0
 
 # [markdown-it-implicit-figures](https://github.com/arve0/markdown-it-implicit-figures)
 v0.10.0
+
+# [markdown-it-mark](https://github.com/markdown-it/markdown-it-mark)
+v4.0.0

+ 2 - 0
src/data/extra/web/js/markdown-it/markdown-it-mark.min.js

@@ -0,0 +1,2 @@
+/*! markdown-it-mark 4.0.0 https://github.com/markdown-it/markdown-it-mark @license MIT */
+!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).markdownitMark=n()}(this,(function(){"use strict";return function(e){function n(e,n){const t=[],o=n.length;for(let s=0;s<o;s++){const o=n[s];if(61!==o.marker)continue;if(-1===o.end)continue;const r=n[o.end],i=e.tokens[o.token];i.type="mark_open",i.tag="mark",i.nesting=1,i.markup="==",i.content="";const c=e.tokens[r.token];c.type="mark_close",c.tag="mark",c.nesting=-1,c.markup="==",c.content="","text"===e.tokens[r.token-1].type&&"="===e.tokens[r.token-1].content&&t.push(r.token-1)}for(;t.length;){const n=t.pop();let o=n+1;for(;o<e.tokens.length&&"mark_close"===e.tokens[o].type;)o++;if(o--,n!==o){const t=e.tokens[o];e.tokens[o]=e.tokens[n],e.tokens[n]=t}}}e.inline.ruler.before("emphasis","mark",(function(e,n){const t=e.pos,o=e.src.charCodeAt(t);if(n)return!1;if(61!==o)return!1;const s=e.scanDelims(e.pos,!0);let r=s.length;const i=String.fromCharCode(o);if(r<2)return!1;if(r%2){e.push("text","",0).content=i,r--}for(let n=0;n<r;n+=2){e.push("text","",0).content=i+i,(s.can_open||s.can_close)&&e.delimiters.push({marker:o,length:0,jump:n/2,token:e.tokens.length-1,end:-1,open:s.can_open,close:s.can_close})}return e.pos+=s.length,!0})),e.inline.ruler2.before("emphasis","mark",(function(e){let t;const o=e.tokens_meta,s=(e.tokens_meta||[]).length;for(n(e,e.delimiters),t=0;t<s;t++)o[t]&&o[t].delimiters&&n(e,o[t].delimiters)}))}}));

+ 2 - 0
src/data/extra/web/js/markdownit.js

@@ -241,6 +241,8 @@ class MarkdownIt extends VxWorker {
         this.mdit.use(window.markdownitImplicitFigure, {
             figcaption: true
         });
+
+        this.mdit.use(window.markdownitMark);
     }
 
     registerInternal() {