rapier-html 1.2.46 → 1.2.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,1344 @@
1
- // Exact pinned plugin bodies; the caller supplies their runtime context. See NOTICE.txt and markdown-plugins.json.
1
+ /*! The eight markdown-it plugins as published; their licences are in NOTICE.txt. */
2
2
  export function createMarkdownPlugins(Math) {
3
3
  if (!Math || typeof Math.ceil !== 'function' || typeof Math.random !== 'function') throw new TypeError('Markdown plugins need a Math context.');
4
4
  const root = {};
5
5
  {
6
6
  const globalThis = root, window = root, global = root, self = root;
7
7
  const exports = undefined, module = undefined, define = undefined;
8
- /*! markdown-it-task-lists 2.1.0 https://github.com/revin/markdown-it-task-lists#readme by @license {ISC} */
9
- !function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.markdownitTaskLists=n()}}(function(){return function(){function n(e,t,i){function r(c,l){if(!t[c]){if(!e[c]){var f="function"==typeof require&&require;if(!l&&f)return f(c,!0);if(o)return o(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var a=t[c]={exports:{}};e[c][0].call(a.exports,function(n){var t=e[c][1][n];return r(t?t:n)},a,a.exports,n,e,t,i)}return t[c].exports}for(var o="function"==typeof require&&require,c=0;c<i.length;c++)r(i[c]);return r}return n}()({1:[function(n,e,t){function i(n,e,t){var i=n.attrIndex(e),r=[e,t];0>i?n.attrPush(r):n.attrs[i]=r}function r(n,e){for(var t=n[e].level-1,i=e-1;i>=0;i--)if(n[i].level===t)return i;return-1}function o(n,e){return s(n[e])&&d(n[e-1])&&h(n[e-2])&&p(n[e])}function c(n,e){if(n.children.unshift(l(n,e)),n.children[1].content=n.children[1].content.slice(3),n.content=n.content.slice(3),b)if(v){n.children.pop();var t="task-item-"+Math.ceil(1e7*Math.random()-1e3);n.children[0].content=n.children[0].content.slice(0,-1)+' id="'+t+'">',n.children.push(a(n.content,t,e))}else n.children.unshift(f(e)),n.children.push(u(e))}function l(n,e){var t=new e("html_inline","",0),i=x?' disabled="" ':"";return 0===n.content.indexOf("[ ] ")?t.content='<input class="task-list-item-checkbox"'+i+'type="checkbox">':(0===n.content.indexOf("[x] ")||0===n.content.indexOf("[X] "))&&(t.content='<input class="task-list-item-checkbox" checked=""'+i+'type="checkbox">'),t}function f(n){var e=new n("html_inline","",0);return e.content="<label>",e}function u(n){var e=new n("html_inline","",0);return e.content="</label>",e}function a(n,e,t){var i=new t("html_inline","",0);return i.content='<label class="task-list-item-label" for="'+e+'">'+n+"</label>",i.attrs=[{"for":e}],i}function s(n){return"inline"===n.type}function d(n){return"paragraph_open"===n.type}function h(n){return"list_item_open"===n.type}function p(n){return 0===n.content.indexOf("[ ] ")||0===n.content.indexOf("[x] ")||0===n.content.indexOf("[X] ")}var x=!0,b=!1,v=!1;e.exports=function(n,e){e&&(x=!e.enabled,b=!!e.label,v=!!e.labelAfter),n.core.ruler.after("inline","github-task-lists",function(n){for(var e=n.tokens,t=2;t<e.length;t++)o(e,t)&&(c(e[t],n.Token),i(e[t-2],"class","task-list-item"+(x?"":" enabled")),i(e[r(e,t-2)],"class","contains-task-list"))})}},{}]},{},[1])(1)});
8
+ /*! markdown-it-task-lists 2.1.0 https://github.com/revin/markdown-it-task-lists#readme by @license ISC */
9
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.markdownitTaskLists = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
10
+
11
+ var disableCheckboxes = true;
12
+ var useLabelWrapper = false;
13
+ var useLabelAfter = false;
14
+
15
+ module.exports = function(md, options) {
16
+ if (options) {
17
+ disableCheckboxes = !options.enabled;
18
+ useLabelWrapper = !!options.label;
19
+ useLabelAfter = !!options.labelAfter;
20
+ }
21
+
22
+ md.core.ruler.after('inline', 'github-task-lists', function(state) {
23
+ var tokens = state.tokens;
24
+ for (var i = 2; i < tokens.length; i++) {
25
+ if (isTodoItem(tokens, i)) {
26
+ todoify(tokens[i], state.Token);
27
+ attrSet(tokens[i-2], 'class', 'task-list-item' + (!disableCheckboxes ? ' enabled' : ''));
28
+ attrSet(tokens[parentToken(tokens, i-2)], 'class', 'contains-task-list');
29
+ }
30
+ }
31
+ });
32
+ };
33
+
34
+ function attrSet(token, name, value) {
35
+ var index = token.attrIndex(name);
36
+ var attr = [name, value];
37
+
38
+ if (index < 0) {
39
+ token.attrPush(attr);
40
+ } else {
41
+ token.attrs[index] = attr;
42
+ }
43
+ }
44
+
45
+ function parentToken(tokens, index) {
46
+ var targetLevel = tokens[index].level - 1;
47
+ for (var i = index - 1; i >= 0; i--) {
48
+ if (tokens[i].level === targetLevel) {
49
+ return i;
50
+ }
51
+ }
52
+ return -1;
53
+ }
54
+
55
+ function isTodoItem(tokens, index) {
56
+ return isInline(tokens[index]) &&
57
+ isParagraph(tokens[index - 1]) &&
58
+ isListItem(tokens[index - 2]) &&
59
+ startsWithTodoMarkdown(tokens[index]);
60
+ }
61
+
62
+ function todoify(token, TokenConstructor) {
63
+ token.children.unshift(makeCheckbox(token, TokenConstructor));
64
+ token.children[1].content = token.children[1].content.slice(3);
65
+ token.content = token.content.slice(3);
66
+
67
+ if (useLabelWrapper) {
68
+ if (useLabelAfter) {
69
+ token.children.pop();
70
+
71
+ var id = 'task-item-' + Math.ceil(Math.random() * (10000 * 1000) - 1000);
72
+ token.children[0].content = token.children[0].content.slice(0, -1) + ' id="' + id + '">';
73
+ token.children.push(afterLabel(token.content, id, TokenConstructor));
74
+ } else {
75
+ token.children.unshift(beginLabel(TokenConstructor));
76
+ token.children.push(endLabel(TokenConstructor));
77
+ }
78
+ }
79
+ }
80
+
81
+ function makeCheckbox(token, TokenConstructor) {
82
+ var checkbox = new TokenConstructor('html_inline', '', 0);
83
+ var disabledAttr = disableCheckboxes ? ' disabled="" ' : '';
84
+ if (token.content.indexOf('[ ] ') === 0) {
85
+ checkbox.content = '<input class="task-list-item-checkbox"' + disabledAttr + 'type="checkbox">';
86
+ } else if (token.content.indexOf('[x] ') === 0 || token.content.indexOf('[X] ') === 0) {
87
+ checkbox.content = '<input class="task-list-item-checkbox" checked=""' + disabledAttr + 'type="checkbox">';
88
+ }
89
+ return checkbox;
90
+ }
91
+
92
+ function beginLabel(TokenConstructor) {
93
+ var token = new TokenConstructor('html_inline', '', 0);
94
+ token.content = '<label>';
95
+ return token;
96
+ }
97
+
98
+ function endLabel(TokenConstructor) {
99
+ var token = new TokenConstructor('html_inline', '', 0);
100
+ token.content = '</label>';
101
+ return token;
102
+ }
103
+
104
+ function afterLabel(content, id, TokenConstructor) {
105
+ var token = new TokenConstructor('html_inline', '', 0);
106
+ token.content = '<label class="task-list-item-label" for="' + id + '">' + content + '</label>';
107
+ token.attrs = [{for: id}];
108
+ return token;
109
+ }
110
+
111
+ function isInline(token) { return token.type === 'inline'; }
112
+ function isParagraph(token) { return token.type === 'paragraph_open'; }
113
+ function isListItem(token) { return token.type === 'list_item_open'; }
114
+
115
+ function startsWithTodoMarkdown(token) {
116
+ return token.content.indexOf('[ ] ') === 0 || token.content.indexOf('[x] ') === 0 || token.content.indexOf('[X] ') === 0;
117
+ }
118
+
119
+ },{}]},{},[1])(1)
120
+ });
10
121
  /*! markdown-it-footnote 4.0.0 https://github.com/markdown-it/markdown-it-footnote @license MIT */
11
- !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).markdownitFootnote=o()}(this,(function(){"use strict";function e(e,o,t,n){const r=Number(e[o].meta.id+1).toString();let s="";return"string"==typeof n.docId&&(s=`-${n.docId}-`),s+r}function o(e,o){let t=Number(e[o].meta.id+1).toString();return e[o].meta.subId>0&&(t+=`:${e[o].meta.subId}`),`[${t}]`}function t(e,o,t,n,r){const s=r.rules.footnote_anchor_name(e,o,t,n,r),f=r.rules.footnote_caption(e,o,t,n,r);let l=s;return e[o].meta.subId>0&&(l+=`:${e[o].meta.subId}`),`<sup class="footnote-ref"><a href="#fn${s}" id="fnref${l}">${f}</a></sup>`}function n(e,o,t){return(t.xhtmlOut?'<hr class="footnotes-sep" />\n':'<hr class="footnotes-sep">\n')+'<section class="footnotes">\n<ol class="footnotes-list">\n'}function r(){return"</ol>\n</section>\n"}function s(e,o,t,n,r){let s=r.rules.footnote_anchor_name(e,o,t,n,r);return e[o].meta.subId>0&&(s+=`:${e[o].meta.subId}`),`<li id="fn${s}" class="footnote-item">`}function f(){return"</li>\n"}function l(e,o,t,n,r){let s=r.rules.footnote_anchor_name(e,o,t,n,r);return e[o].meta.subId>0&&(s+=`:${e[o].meta.subId}`),` <a href="#fnref${s}" class="footnote-backref">\u21a9\ufe0e</a>`}return function(c){const i=c.helpers.parseLinkLabel,u=c.utils.isSpace;c.renderer.rules.footnote_ref=t,c.renderer.rules.footnote_block_open=n,c.renderer.rules.footnote_block_close=r,c.renderer.rules.footnote_open=s,c.renderer.rules.footnote_close=f,c.renderer.rules.footnote_anchor=l,c.renderer.rules.footnote_caption=o,c.renderer.rules.footnote_anchor_name=e,c.block.ruler.before("reference","footnote_def",(function(e,o,t,n){const r=e.bMarks[o]+e.tShift[o],s=e.eMarks[o];if(r+4>s)return!1;if(91!==e.src.charCodeAt(r))return!1;if(94!==e.src.charCodeAt(r+1))return!1;let f;for(f=r+2;f<s;f++){if(32===e.src.charCodeAt(f))return!1;if(93===e.src.charCodeAt(f))break}if(f===r+2)return!1;if(f+1>=s||58!==e.src.charCodeAt(++f))return!1;if(n)return!0;f++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={});const l=e.src.slice(r+2,f-2);e.env.footnotes.refs[`:${l}`]=-1;const c=new e.Token("footnote_reference_open","",1);c.meta={label:l},c.level=e.level++,e.tokens.push(c);const i=e.bMarks[o],a=e.tShift[o],p=e.sCount[o],d=e.parentType,h=f,k=e.sCount[o]+f-(e.bMarks[o]+e.tShift[o]);let b=k;for(;f<s;){const o=e.src.charCodeAt(f);if(!u(o))break;9===o?b+=4-b%4:b++,f++}e.tShift[o]=f-h,e.sCount[o]=b-k,e.bMarks[o]=h,e.blkIndent+=4,e.parentType="footnote",e.sCount[o]<e.blkIndent&&(e.sCount[o]+=e.blkIndent),e.md.block.tokenize(e,o,t,!0),e.parentType=d,e.blkIndent-=4,e.tShift[o]=a,e.sCount[o]=p,e.bMarks[o]=i;const _=new e.Token("footnote_reference_close","",-1);return _.level=--e.level,e.tokens.push(_),!0}),{alt:["paragraph","reference"]}),c.inline.ruler.after("image","footnote_inline",(function(e,o){const t=e.posMax,n=e.pos;if(n+2>=t)return!1;if(94!==e.src.charCodeAt(n))return!1;if(91!==e.src.charCodeAt(n+1))return!1;const r=n+2,s=i(e,n+1);if(s<0)return!1;if(!o){e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]);const o=e.env.footnotes.list.length,t=[];e.md.inline.parse(e.src.slice(r,s),e.md,e.env,t);e.push("footnote_ref","",0).meta={id:o},e.env.footnotes.list[o]={content:e.src.slice(r,s),tokens:t}}return e.pos=s+1,e.posMax=t,!0})),c.inline.ruler.after("footnote_inline","footnote_ref",(function(e,o){const t=e.posMax,n=e.pos;if(n+3>t)return!1;if(!e.env.footnotes||!e.env.footnotes.refs)return!1;if(91!==e.src.charCodeAt(n))return!1;if(94!==e.src.charCodeAt(n+1))return!1;let r;for(r=n+2;r<t;r++){if(32===e.src.charCodeAt(r))return!1;if(10===e.src.charCodeAt(r))return!1;if(93===e.src.charCodeAt(r))break}if(r===n+2)return!1;if(r>=t)return!1;r++;const s=e.src.slice(n+2,r-1);if(void 0===e.env.footnotes.refs[`:${s}`])return!1;if(!o){let o;e.env.footnotes.list||(e.env.footnotes.list=[]),e.env.footnotes.refs[`:${s}`]<0?(o=e.env.footnotes.list.length,e.env.footnotes.list[o]={label:s,count:0},e.env.footnotes.refs[`:${s}`]=o):o=e.env.footnotes.refs[`:${s}`];const t=e.env.footnotes.list[o].count;e.env.footnotes.list[o].count++;e.push("footnote_ref","",0).meta={id:o,subId:t,label:s}}return e.pos=r,e.posMax=t,!0})),c.core.ruler.after("inline","footnote_tail",(function(e){let o,t,n,r=!1;const s={};if(!e.env.footnotes)return;if(e.tokens=e.tokens.filter((function(e){return"footnote_reference_open"===e.type?(r=!0,t=[],n=e.meta.label,!1):"footnote_reference_close"===e.type?(r=!1,s[":"+n]=t,!1):(r&&t.push(e),!r)})),!e.env.footnotes.list)return;const f=e.env.footnotes.list;e.tokens.push(new e.Token("footnote_block_open","",1));for(let t=0,n=f.length;t<n;t++){const n=new e.Token("footnote_open","",1);if(n.meta={id:t,label:f[t].label},e.tokens.push(n),f[t].tokens){o=[];const n=new e.Token("paragraph_open","p",1);n.block=!0,o.push(n);const r=new e.Token("inline","",0);r.children=f[t].tokens,r.content=f[t].content,o.push(r);const s=new e.Token("paragraph_close","p",-1);s.block=!0,o.push(s)}else f[t].label&&(o=s[`:${f[t].label}`]);let r;o&&(e.tokens=e.tokens.concat(o)),r="paragraph_close"===e.tokens[e.tokens.length-1].type?e.tokens.pop():null;const l=f[t].count>0?f[t].count:1;for(let o=0;o<l;o++){const n=new e.Token("footnote_anchor","",0);n.meta={id:t,subId:o,label:f[t].label},e.tokens.push(n)}r&&e.tokens.push(r),e.tokens.push(new e.Token("footnote_close","",-1))}e.tokens.push(new e.Token("footnote_block_close","",-1))}))}}));
122
+ (function(global, factory) {
123
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
124
+ global.markdownitFootnote = factory());
125
+ })(this, (function() {
126
+ "use strict";
127
+
128
+ function render_footnote_anchor_name(tokens, idx, options, env ) {
129
+ const n = Number(tokens[idx].meta.id + 1).toString();
130
+ let prefix = "";
131
+ if (typeof env.docId === "string") prefix = "-" + env.docId + "-";
132
+ return prefix + n;
133
+ }
134
+ function render_footnote_caption(tokens, idx ) {
135
+ let n = Number(tokens[idx].meta.id + 1).toString();
136
+ if (tokens[idx].meta.subId > 0) n += `:${tokens[idx].meta.subId}`;
137
+ return `[${n}]`;
138
+ }
139
+ function render_footnote_ref(tokens, idx, options, env, slf) {
140
+ const id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
141
+ const caption = slf.rules.footnote_caption(tokens, idx, options, env, slf);
142
+ let refid = id;
143
+ if (tokens[idx].meta.subId > 0) refid += `:${tokens[idx].meta.subId}`;
144
+ return `<sup class="footnote-ref"><a href="#fn${id}" id="fnref${refid}">${caption}</a></sup>`;
145
+ }
146
+ function render_footnote_block_open(tokens, idx, options) {
147
+ return (options.xhtmlOut ? '<hr class="footnotes-sep" />\n' : '<hr class="footnotes-sep">\n') + '<section class="footnotes">\n' + '<ol class="footnotes-list">\n';
148
+ }
149
+ function render_footnote_block_close() {
150
+ return "</ol>\n</section>\n";
151
+ }
152
+ function render_footnote_open(tokens, idx, options, env, slf) {
153
+ let id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
154
+ if (tokens[idx].meta.subId > 0) id += `:${tokens[idx].meta.subId}`;
155
+ return `<li id="fn${id}" class="footnote-item">`;
156
+ }
157
+ function render_footnote_close() {
158
+ return "</li>\n";
159
+ }
160
+ function render_footnote_anchor(tokens, idx, options, env, slf) {
161
+ let id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
162
+ if (tokens[idx].meta.subId > 0) id += `:${tokens[idx].meta.subId}`
163
+ ;
164
+ return ` <a href="#fnref${id}" class="footnote-backref">\u21a9\ufe0e</a>`;
165
+ }
166
+ function footnote_plugin(md) {
167
+ const parseLinkLabel = md.helpers.parseLinkLabel;
168
+ const isSpace = md.utils.isSpace;
169
+ md.renderer.rules.footnote_ref = render_footnote_ref;
170
+ md.renderer.rules.footnote_block_open = render_footnote_block_open;
171
+ md.renderer.rules.footnote_block_close = render_footnote_block_close;
172
+ md.renderer.rules.footnote_open = render_footnote_open;
173
+ md.renderer.rules.footnote_close = render_footnote_close;
174
+ md.renderer.rules.footnote_anchor = render_footnote_anchor;
175
+ md.renderer.rules.footnote_caption = render_footnote_caption;
176
+ md.renderer.rules.footnote_anchor_name = render_footnote_anchor_name;
177
+ function footnote_def(state, startLine, endLine, silent) {
178
+ const start = state.bMarks[startLine] + state.tShift[startLine];
179
+ const max = state.eMarks[startLine];
180
+ if (start + 4 > max) return false;
181
+ if (state.src.charCodeAt(start) !== 91 ) return false;
182
+ if (state.src.charCodeAt(start + 1) !== 94 ) return false;
183
+ let pos;
184
+ for (pos = start + 2; pos < max; pos++) {
185
+ if (state.src.charCodeAt(pos) === 32) return false;
186
+ if (state.src.charCodeAt(pos) === 93 ) {
187
+ break;
188
+ }
189
+ }
190
+ if (pos === start + 2) return false;
191
+ if (pos + 1 >= max || state.src.charCodeAt(++pos) !== 58 ) return false;
192
+ if (silent) return true;
193
+ pos++;
194
+ if (!state.env.footnotes) state.env.footnotes = {};
195
+ if (!state.env.footnotes.refs) state.env.footnotes.refs = {};
196
+ const label = state.src.slice(start + 2, pos - 2);
197
+ state.env.footnotes.refs[`:${label}`] = -1;
198
+ const token_fref_o = new state.Token("footnote_reference_open", "", 1);
199
+ token_fref_o.meta = {
200
+ label: label
201
+ };
202
+ token_fref_o.level = state.level++;
203
+ state.tokens.push(token_fref_o);
204
+ const oldBMark = state.bMarks[startLine];
205
+ const oldTShift = state.tShift[startLine];
206
+ const oldSCount = state.sCount[startLine];
207
+ const oldParentType = state.parentType;
208
+ const posAfterColon = pos;
209
+ const initial = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);
210
+ let offset = initial;
211
+ while (pos < max) {
212
+ const ch = state.src.charCodeAt(pos);
213
+ if (isSpace(ch)) {
214
+ if (ch === 9) {
215
+ offset += 4 - offset % 4;
216
+ } else {
217
+ offset++;
218
+ }
219
+ } else {
220
+ break;
221
+ }
222
+ pos++;
223
+ }
224
+ state.tShift[startLine] = pos - posAfterColon;
225
+ state.sCount[startLine] = offset - initial;
226
+ state.bMarks[startLine] = posAfterColon;
227
+ state.blkIndent += 4;
228
+ state.parentType = "footnote";
229
+ if (state.sCount[startLine] < state.blkIndent) {
230
+ state.sCount[startLine] += state.blkIndent;
231
+ }
232
+ state.md.block.tokenize(state, startLine, endLine, true);
233
+ state.parentType = oldParentType;
234
+ state.blkIndent -= 4;
235
+ state.tShift[startLine] = oldTShift;
236
+ state.sCount[startLine] = oldSCount;
237
+ state.bMarks[startLine] = oldBMark;
238
+ const token_fref_c = new state.Token("footnote_reference_close", "", -1);
239
+ token_fref_c.level = --state.level;
240
+ state.tokens.push(token_fref_c);
241
+ return true;
242
+ }
243
+ function footnote_inline(state, silent) {
244
+ const max = state.posMax;
245
+ const start = state.pos;
246
+ if (start + 2 >= max) return false;
247
+ if (state.src.charCodeAt(start) !== 94 ) return false;
248
+ if (state.src.charCodeAt(start + 1) !== 91 ) return false;
249
+ const labelStart = start + 2;
250
+ const labelEnd = parseLinkLabel(state, start + 1);
251
+ if (labelEnd < 0) return false;
252
+
253
+ if (!silent) {
254
+ if (!state.env.footnotes) state.env.footnotes = {};
255
+ if (!state.env.footnotes.list) state.env.footnotes.list = [];
256
+ const footnoteId = state.env.footnotes.list.length;
257
+ const tokens = [];
258
+ state.md.inline.parse(state.src.slice(labelStart, labelEnd), state.md, state.env, tokens);
259
+ const token = state.push("footnote_ref", "", 0);
260
+ token.meta = {
261
+ id: footnoteId
262
+ };
263
+ state.env.footnotes.list[footnoteId] = {
264
+ content: state.src.slice(labelStart, labelEnd),
265
+ tokens: tokens
266
+ };
267
+ }
268
+ state.pos = labelEnd + 1;
269
+ state.posMax = max;
270
+ return true;
271
+ }
272
+ function footnote_ref(state, silent) {
273
+ const max = state.posMax;
274
+ const start = state.pos;
275
+ if (start + 3 > max) return false;
276
+ if (!state.env.footnotes || !state.env.footnotes.refs) return false;
277
+ if (state.src.charCodeAt(start) !== 91 ) return false;
278
+ if (state.src.charCodeAt(start + 1) !== 94 ) return false;
279
+ let pos;
280
+ for (pos = start + 2; pos < max; pos++) {
281
+ if (state.src.charCodeAt(pos) === 32) return false;
282
+ if (state.src.charCodeAt(pos) === 10) return false;
283
+ if (state.src.charCodeAt(pos) === 93 ) {
284
+ break;
285
+ }
286
+ }
287
+ if (pos === start + 2) return false;
288
+ if (pos >= max) return false;
289
+ pos++;
290
+ const label = state.src.slice(start + 2, pos - 1);
291
+ if (typeof state.env.footnotes.refs[`:${label}`] === "undefined") return false;
292
+ if (!silent) {
293
+ if (!state.env.footnotes.list) state.env.footnotes.list = [];
294
+ let footnoteId;
295
+ if (state.env.footnotes.refs[`:${label}`] < 0) {
296
+ footnoteId = state.env.footnotes.list.length;
297
+ state.env.footnotes.list[footnoteId] = {
298
+ label: label,
299
+ count: 0
300
+ };
301
+ state.env.footnotes.refs[`:${label}`] = footnoteId;
302
+ } else {
303
+ footnoteId = state.env.footnotes.refs[`:${label}`];
304
+ }
305
+ const footnoteSubId = state.env.footnotes.list[footnoteId].count;
306
+ state.env.footnotes.list[footnoteId].count++;
307
+ const token = state.push("footnote_ref", "", 0);
308
+ token.meta = {
309
+ id: footnoteId,
310
+ subId: footnoteSubId,
311
+ label: label
312
+ };
313
+ }
314
+ state.pos = pos;
315
+ state.posMax = max;
316
+ return true;
317
+ }
318
+ function footnote_tail(state) {
319
+ let tokens;
320
+ let current;
321
+ let currentLabel;
322
+ let insideRef = false;
323
+ const refTokens = {};
324
+ if (!state.env.footnotes) {
325
+ return;
326
+ }
327
+ state.tokens = state.tokens.filter((function(tok) {
328
+ if (tok.type === "footnote_reference_open") {
329
+ insideRef = true;
330
+ current = [];
331
+ currentLabel = tok.meta.label;
332
+ return false;
333
+ }
334
+ if (tok.type === "footnote_reference_close") {
335
+ insideRef = false;
336
+ refTokens[":" + currentLabel] = current;
337
+ return false;
338
+ }
339
+ if (insideRef) {
340
+ current.push(tok);
341
+ }
342
+ return !insideRef;
343
+ }));
344
+ if (!state.env.footnotes.list) {
345
+ return;
346
+ }
347
+ const list = state.env.footnotes.list;
348
+ state.tokens.push(new state.Token("footnote_block_open", "", 1));
349
+ for (let i = 0, l = list.length; i < l; i++) {
350
+ const token_fo = new state.Token("footnote_open", "", 1);
351
+ token_fo.meta = {
352
+ id: i,
353
+ label: list[i].label
354
+ };
355
+ state.tokens.push(token_fo);
356
+ if (list[i].tokens) {
357
+ tokens = [];
358
+ const token_po = new state.Token("paragraph_open", "p", 1);
359
+ token_po.block = true;
360
+ tokens.push(token_po);
361
+ const token_i = new state.Token("inline", "", 0);
362
+ token_i.children = list[i].tokens;
363
+ token_i.content = list[i].content;
364
+ tokens.push(token_i);
365
+ const token_pc = new state.Token("paragraph_close", "p", -1);
366
+ token_pc.block = true;
367
+ tokens.push(token_pc);
368
+ } else if (list[i].label) {
369
+ tokens = refTokens[`:${list[i].label}`];
370
+ }
371
+ if (tokens) state.tokens = state.tokens.concat(tokens);
372
+ let lastParagraph;
373
+ if (state.tokens[state.tokens.length - 1].type === "paragraph_close") {
374
+ lastParagraph = state.tokens.pop();
375
+ } else {
376
+ lastParagraph = null;
377
+ }
378
+ const t = list[i].count > 0 ? list[i].count : 1;
379
+ for (let j = 0; j < t; j++) {
380
+ const token_a = new state.Token("footnote_anchor", "", 0);
381
+ token_a.meta = {
382
+ id: i,
383
+ subId: j,
384
+ label: list[i].label
385
+ };
386
+ state.tokens.push(token_a);
387
+ }
388
+ if (lastParagraph) {
389
+ state.tokens.push(lastParagraph);
390
+ }
391
+ state.tokens.push(new state.Token("footnote_close", "", -1));
392
+ }
393
+ state.tokens.push(new state.Token("footnote_block_close", "", -1));
394
+ }
395
+ md.block.ruler.before("reference", "footnote_def", footnote_def, {
396
+ alt: [ "paragraph", "reference" ]
397
+ });
398
+ md.inline.ruler.after("image", "footnote_inline", footnote_inline);
399
+ md.inline.ruler.after("footnote_inline", "footnote_ref", footnote_ref);
400
+ md.core.ruler.after("inline", "footnote_tail", footnote_tail);
401
+ }
402
+ return footnote_plugin;
403
+ }));
12
404
  /*! markdown-it-mark 4.0.0 https://github.com/markdown-it/markdown-it-mark @license MIT */
13
- !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)}))}}));
405
+ (function(global, factory) {
406
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
407
+ global.markdownitMark = factory());
408
+ })(this, (function() {
409
+ "use strict";
410
+ function ins_plugin(md) {
411
+ function tokenize(state, silent) {
412
+ const start = state.pos;
413
+ const marker = state.src.charCodeAt(start);
414
+ if (silent) {
415
+ return false;
416
+ }
417
+ if (marker !== 61 ) {
418
+ return false;
419
+ }
420
+ const scanned = state.scanDelims(state.pos, true);
421
+ let len = scanned.length;
422
+ const ch = String.fromCharCode(marker);
423
+ if (len < 2) {
424
+ return false;
425
+ }
426
+ if (len % 2) {
427
+ const token = state.push("text", "", 0);
428
+ token.content = ch;
429
+ len--;
430
+ }
431
+ for (let i = 0; i < len; i += 2) {
432
+ const token = state.push("text", "", 0);
433
+ token.content = ch + ch;
434
+ if (!scanned.can_open && !scanned.can_close) {
435
+ continue;
436
+ }
437
+ state.delimiters.push({
438
+ marker: marker,
439
+ length: 0,
440
+ jump: i / 2,
441
+ token: state.tokens.length - 1,
442
+ end: -1,
443
+ open: scanned.can_open,
444
+ close: scanned.can_close
445
+ });
446
+ }
447
+ state.pos += scanned.length;
448
+ return true;
449
+ }
450
+
451
+ function postProcess(state, delimiters) {
452
+ const loneMarkers = [];
453
+ const max = delimiters.length;
454
+ for (let i = 0; i < max; i++) {
455
+ const startDelim = delimiters[i];
456
+ if (startDelim.marker !== 61 ) {
457
+ continue;
458
+ }
459
+ if (startDelim.end === -1) {
460
+ continue;
461
+ }
462
+ const endDelim = delimiters[startDelim.end];
463
+ const token_o = state.tokens[startDelim.token];
464
+ token_o.type = "mark_open";
465
+ token_o.tag = "mark";
466
+ token_o.nesting = 1;
467
+ token_o.markup = "==";
468
+ token_o.content = "";
469
+ const token_c = state.tokens[endDelim.token];
470
+ token_c.type = "mark_close";
471
+ token_c.tag = "mark";
472
+ token_c.nesting = -1;
473
+ token_c.markup = "==";
474
+ token_c.content = "";
475
+ if (state.tokens[endDelim.token - 1].type === "text" && state.tokens[endDelim.token - 1].content === "=") {
476
+ loneMarkers.push(endDelim.token - 1);
477
+ }
478
+ }
479
+
480
+
481
+ while (loneMarkers.length) {
482
+ const i = loneMarkers.pop();
483
+ let j = i + 1;
484
+ while (j < state.tokens.length && state.tokens[j].type === "mark_close") {
485
+ j++;
486
+ }
487
+ j--;
488
+ if (i !== j) {
489
+ const token = state.tokens[j];
490
+ state.tokens[j] = state.tokens[i];
491
+ state.tokens[i] = token;
492
+ }
493
+ }
494
+ }
495
+ md.inline.ruler.before("emphasis", "mark", tokenize);
496
+ md.inline.ruler2.before("emphasis", "mark", (function(state) {
497
+ let curr;
498
+ const tokens_meta = state.tokens_meta;
499
+ const max = (state.tokens_meta || []).length;
500
+ postProcess(state, state.delimiters);
501
+ for (curr = 0; curr < max; curr++) {
502
+ if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
503
+ postProcess(state, tokens_meta[curr].delimiters);
504
+ }
505
+ }
506
+ }));
507
+ }
508
+ return ins_plugin;
509
+ }));
14
510
  /*! markdown-it-sup 2.0.0 https://github.com/markdown-it/markdown-it-sup @license MIT */
15
- !function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):(e="undefined"!=typeof globalThis?globalThis:e||self).markdownitSup=s()}(this,(function(){"use strict";const e=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;function s(s,o){const n=s.posMax,p=s.pos;if(94!==s.src.charCodeAt(p))return!1;if(o)return!1;if(p+2>=n)return!1;s.pos=p+1;let t=!1;for(;s.pos<n;){if(94===s.src.charCodeAt(s.pos)){t=!0;break}s.md.inline.skipToken(s)}if(!t||p+1===s.pos)return s.pos=p,!1;const r=s.src.slice(p+1,s.pos);if(r.match(/(^|[^\\])(\\\\)*\s/))return s.pos=p,!1;s.posMax=s.pos,s.pos=p+1;s.push("sup_open","sup",1).markup="^";s.push("text","",0).content=r.replace(e,"$1");return s.push("sup_close","sup",-1).markup="^",s.pos=s.posMax+1,s.posMax=n,!0}return function(e){e.inline.ruler.after("emphasis","sup",s)}}));
511
+ (function(global, factory) {
512
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
513
+ global.markdownitSup = factory());
514
+ })(this, (function() {
515
+ "use strict";
516
+ const UNESCAPE_RE = /\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;
517
+ function superscript(state, silent) {
518
+ const max = state.posMax;
519
+ const start = state.pos;
520
+ if (state.src.charCodeAt(start) !== 94 ) {
521
+ return false;
522
+ }
523
+ if (silent) {
524
+ return false;
525
+ }
526
+ if (start + 2 >= max) {
527
+ return false;
528
+ }
529
+ state.pos = start + 1;
530
+ let found = false;
531
+ while (state.pos < max) {
532
+ if (state.src.charCodeAt(state.pos) === 94 ) {
533
+ found = true;
534
+ break;
535
+ }
536
+ state.md.inline.skipToken(state);
537
+ }
538
+ if (!found || start + 1 === state.pos) {
539
+ state.pos = start;
540
+ return false;
541
+ }
542
+ const content = state.src.slice(start + 1, state.pos);
543
+ if (content.match(/(^|[^\\])(\\\\)*\s/)) {
544
+ state.pos = start;
545
+ return false;
546
+ }
547
+ state.posMax = state.pos;
548
+ state.pos = start + 1;
549
+ const token_so = state.push("sup_open", "sup", 1);
550
+ token_so.markup = "^";
551
+ const token_t = state.push("text", "", 0);
552
+ token_t.content = content.replace(UNESCAPE_RE, "$1");
553
+ const token_sc = state.push("sup_close", "sup", -1);
554
+ token_sc.markup = "^";
555
+ state.pos = state.posMax + 1;
556
+ state.posMax = max;
557
+ return true;
558
+ }
559
+ function sup_plugin(md) {
560
+ md.inline.ruler.after("emphasis", "sup", superscript);
561
+ }
562
+ return sup_plugin;
563
+ }));
16
564
  /*! markdown-it-emoji 3.1.0 https://github.com/[object Object] @license MIT */
17
- !function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):(e="undefined"!=typeof globalThis?globalThis:e||self).markdownitEmoji=s()}(this,function(){"use strict";var e={grinning:"\ud83d\ude00",smiley:"\ud83d\ude03",smile:"\ud83d\ude04",grin:"\ud83d\ude01",laughing:"\ud83d\ude06",satisfied:"\ud83d\ude06",sweat_smile:"\ud83d\ude05",joy:"\ud83d\ude02",wink:"\ud83d\ude09",blush:"\ud83d\ude0a",innocent:"\ud83d\ude07",heart_eyes:"\ud83d\ude0d",kissing_heart:"\ud83d\ude18",kissing:"\ud83d\ude17",kissing_closed_eyes:"\ud83d\ude1a",kissing_smiling_eyes:"\ud83d\ude19",yum:"\ud83d\ude0b",stuck_out_tongue:"\ud83d\ude1b",stuck_out_tongue_winking_eye:"\ud83d\ude1c",stuck_out_tongue_closed_eyes:"\ud83d\ude1d",neutral_face:"\ud83d\ude10",expressionless:"\ud83d\ude11",no_mouth:"\ud83d\ude36",smirk:"\ud83d\ude0f",unamused:"\ud83d\ude12",relieved:"\ud83d\ude0c",pensive:"\ud83d\ude14",sleepy:"\ud83d\ude2a",sleeping:"\ud83d\ude34",mask:"\ud83d\ude37",dizzy_face:"\ud83d\ude35",sunglasses:"\ud83d\ude0e",confused:"\ud83d\ude15",worried:"\ud83d\ude1f",open_mouth:"\ud83d\ude2e",hushed:"\ud83d\ude2f",astonished:"\ud83d\ude32",flushed:"\ud83d\ude33",frowning:"\ud83d\ude26",anguished:"\ud83d\ude27",fearful:"\ud83d\ude28",cold_sweat:"\ud83d\ude30",disappointed_relieved:"\ud83d\ude25",cry:"\ud83d\ude22",sob:"\ud83d\ude2d",scream:"\ud83d\ude31",confounded:"\ud83d\ude16",persevere:"\ud83d\ude23",disappointed:"\ud83d\ude1e",sweat:"\ud83d\ude13",weary:"\ud83d\ude29",tired_face:"\ud83d\ude2b",rage:"\ud83d\ude21",pout:"\ud83d\ude21",angry:"\ud83d\ude20",smiling_imp:"\ud83d\ude08",smiley_cat:"\ud83d\ude3a",smile_cat:"\ud83d\ude38",joy_cat:"\ud83d\ude39",heart_eyes_cat:"\ud83d\ude3b",smirk_cat:"\ud83d\ude3c",kissing_cat:"\ud83d\ude3d",scream_cat:"\ud83d\ude40",crying_cat_face:"\ud83d\ude3f",pouting_cat:"\ud83d\ude3e",heart:"\u2764\ufe0f",hand:"\u270b",raised_hand:"\u270b",v:"\u270c\ufe0f",point_up:"\u261d\ufe0f",fist_raised:"\u270a",fist:"\u270a",monkey_face:"\ud83d\udc35",cat:"\ud83d\udc31",cow:"\ud83d\udc2e",mouse:"\ud83d\udc2d",coffee:"\u2615",hotsprings:"\u2668\ufe0f",anchor:"\u2693",airplane:"\u2708\ufe0f",hourglass:"\u231b",watch:"\u231a",sunny:"\u2600\ufe0f",star:"\u2b50",cloud:"\u2601\ufe0f",umbrella:"\u2614",zap:"\u26a1",snowflake:"\u2744\ufe0f",sparkles:"\u2728",black_joker:"\ud83c\udccf",mahjong:"\ud83c\udc04",phone:"\u260e\ufe0f",telephone:"\u260e\ufe0f",envelope:"\u2709\ufe0f",pencil2:"\u270f\ufe0f",black_nib:"\u2712\ufe0f",scissors:"\u2702\ufe0f",wheelchair:"\u267f",warning:"\u26a0\ufe0f",aries:"\u2648",taurus:"\u2649",gemini:"\u264a",cancer:"\u264b",leo:"\u264c",virgo:"\u264d",libra:"\u264e",scorpius:"\u264f",sagittarius:"\u2650",capricorn:"\u2651",aquarius:"\u2652",pisces:"\u2653",heavy_multiplication_x:"\u2716\ufe0f",heavy_plus_sign:"\u2795",heavy_minus_sign:"\u2796",heavy_division_sign:"\u2797",bangbang:"\u203c\ufe0f",interrobang:"\u2049\ufe0f",question:"\u2753",grey_question:"\u2754",grey_exclamation:"\u2755",exclamation:"\u2757",heavy_exclamation_mark:"\u2757",wavy_dash:"\u3030\ufe0f",recycle:"\u267b\ufe0f",white_check_mark:"\u2705",ballot_box_with_check:"\u2611\ufe0f",heavy_check_mark:"\u2714\ufe0f",x:"\u274c",negative_squared_cross_mark:"\u274e",curly_loop:"\u27b0",loop:"\u27bf",part_alternation_mark:"\u303d\ufe0f",eight_spoked_asterisk:"\u2733\ufe0f",eight_pointed_black_star:"\u2734\ufe0f",sparkle:"\u2747\ufe0f",copyright:"\xa9\ufe0f",registered:"\xae\ufe0f",tm:"\u2122\ufe0f",information_source:"\u2139\ufe0f",m:"\u24c2\ufe0f",black_circle:"\u26ab",white_circle:"\u26aa",black_large_square:"\u2b1b",white_large_square:"\u2b1c",black_medium_square:"\u25fc\ufe0f",white_medium_square:"\u25fb\ufe0f",black_medium_small_square:"\u25fe",white_medium_small_square:"\u25fd",black_small_square:"\u25aa\ufe0f",white_small_square:"\u25ab\ufe0f"},s={angry:[">:(",">:-("],blush:[':")',':-")'],broken_heart:["</3","<\\3"],confused:[":/",":-/"],cry:[":'(",":'-(",":,(",":,-("],frowning:[":(",":-("],heart:["<3"],imp:["]:(","]:-("],innocent:["o:)","O:)","o:-)","O:-)","0:)","0:-)"],joy:[":')",":'-)",":,)",":,-)",":'D",":'-D",":,D",":,-D"],kissing:[":*",":-*"],laughing:["x-)","X-)"],neutral_face:[":|",":-|"],open_mouth:[":o",":-o",":O",":-O"],rage:[":@",":-@"],smile:[":D",":-D"],smiley:[":)",":-)"],smiling_imp:["]:)","]:-)"],sob:[":,'(",":,'-(",";(",";-("],stuck_out_tongue:[":P",":-P"],sunglasses:["8-)","B-)"],sweat:[",:(",",:-("],sweat_smile:[",:)",",:-)"],unamused:[":s",":-S",":z",":-Z",":$",":-$"],wink:[";)",";-)"]};function t(e,s){return e[s].content}function n(e,s){const n=function(e){let s=e.defs;e.enabled.length&&(s=Object.keys(s).reduce((t,n)=>(e.enabled.indexOf(n)>=0&&(t[n]=s[n]),t),{}));const t=Object.keys(e.shortcuts).reduce((t,n)=>s[n]?Array.isArray(e.shortcuts[n])?(e.shortcuts[n].forEach(e=>{t[e]=n}),t):(t[e.shortcuts[n]]=n,t):t,{}),n=Object.keys(s);let i;i=0===n.length?"^$":n.map(e=>`:${e}:`).concat(Object.keys(t)).sort().reverse().map(e=>e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")).join("|");const a=RegExp(i),o=RegExp(i,"g");return{defs:s,shortcuts:t,scanRE:a,replaceRE:o}}(Object.assign({},{defs:{},shortcuts:{},enabled:[]},s||{}));e.renderer.rules.emoji=t,e.core.ruler.after("linkify","emoji",function(e,s,t,n,i){const a=e.utils.arrayReplaceAt,o=e.utils.lib.ucmicro,r=new RegExp([o.Z.source,o.P.source,o.Cc.source].join("|"));function c(e,n,a){let o=0;const c=[];if(e.replace(i,function(n,i,l){let u;if(Object.prototype.hasOwnProperty.call(t,n)){if(u=t[n],i>0&&!r.test(l[i-1]))return;if(i+n.length<l.length&&!r.test(l[i+n.length]))return}else u=n.slice(1,-1);if(i>o){const s=new a("text","",0);s.content=e.slice(o,i),c.push(s)}const _=new a("emoji","",0);_.markup=u,_.content=s[u],c.push(_),o=i+n.length}),o<e.length){const s=new a("text","",0);s.content=e.slice(o),c.push(s)}return c}return function(e){let s;const t=e.tokens;let i=0;for(let o=0,r=t.length;o<r;o++){if("inline"!==t[o].type)continue;let r=t[o].children;for(let l=r.length-1;l>=0;l--)s=r[l],"link_open"!==s.type&&"link_close"!==s.type||"auto"===s.info&&(i-=s.nesting),"text"===s.type&&0===i&&n.test(s.content)&&(t[o].children=r=a(r,l,c(s.content,s.level,e.Token)))}}}(e,n.defs,n.shortcuts,n.scanRE,n.replaceRE))}return function(t,i){const a={defs:e,shortcuts:s,enabled:[]};n(t,Object.assign({},a,i||{}))}});
565
+ (function (global, factory) {
566
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
567
+ typeof define === 'function' && define.amd ? define(factory) :
568
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.markdownitEmoji = factory());
569
+ })(this, (function () { 'use strict';
570
+
571
+ var emojies_defs = {
572
+ "grinning": "😀",
573
+ "smiley": "😃",
574
+ "smile": "😄",
575
+ "grin": "😁",
576
+ "laughing": "😆",
577
+ "satisfied": "😆",
578
+ "sweat_smile": "😅",
579
+ "joy": "😂",
580
+ "wink": "😉",
581
+ "blush": "😊",
582
+ "innocent": "😇",
583
+ "heart_eyes": "😍",
584
+ "kissing_heart": "😘",
585
+ "kissing": "😗",
586
+ "kissing_closed_eyes": "😚",
587
+ "kissing_smiling_eyes": "😙",
588
+ "yum": "😋",
589
+ "stuck_out_tongue": "😛",
590
+ "stuck_out_tongue_winking_eye": "😜",
591
+ "stuck_out_tongue_closed_eyes": "😝",
592
+ "neutral_face": "😐",
593
+ "expressionless": "😑",
594
+ "no_mouth": "😶",
595
+ "smirk": "😏",
596
+ "unamused": "😒",
597
+ "relieved": "😌",
598
+ "pensive": "😔",
599
+ "sleepy": "😪",
600
+ "sleeping": "😴",
601
+ "mask": "😷",
602
+ "dizzy_face": "😵",
603
+ "sunglasses": "😎",
604
+ "confused": "😕",
605
+ "worried": "😟",
606
+ "open_mouth": "😮",
607
+ "hushed": "😯",
608
+ "astonished": "😲",
609
+ "flushed": "😳",
610
+ "frowning": "😦",
611
+ "anguished": "😧",
612
+ "fearful": "😨",
613
+ "cold_sweat": "😰",
614
+ "disappointed_relieved": "😥",
615
+ "cry": "😢",
616
+ "sob": "😭",
617
+ "scream": "😱",
618
+ "confounded": "😖",
619
+ "persevere": "😣",
620
+ "disappointed": "😞",
621
+ "sweat": "😓",
622
+ "weary": "😩",
623
+ "tired_face": "😫",
624
+ "rage": "😡",
625
+ "pout": "😡",
626
+ "angry": "😠",
627
+ "smiling_imp": "😈",
628
+ "smiley_cat": "😺",
629
+ "smile_cat": "😸",
630
+ "joy_cat": "😹",
631
+ "heart_eyes_cat": "😻",
632
+ "smirk_cat": "😼",
633
+ "kissing_cat": "😽",
634
+ "scream_cat": "🙀",
635
+ "crying_cat_face": "😿",
636
+ "pouting_cat": "😾",
637
+ "heart": "❤️",
638
+ "hand": "✋",
639
+ "raised_hand": "✋",
640
+ "v": "✌️",
641
+ "point_up": "☝️",
642
+ "fist_raised": "✊",
643
+ "fist": "✊",
644
+ "monkey_face": "🐵",
645
+ "cat": "🐱",
646
+ "cow": "🐮",
647
+ "mouse": "🐭",
648
+ "coffee": "☕",
649
+ "hotsprings": "♨️",
650
+ "anchor": "⚓",
651
+ "airplane": "✈️",
652
+ "hourglass": "⌛",
653
+ "watch": "⌚",
654
+ "sunny": "☀️",
655
+ "star": "⭐",
656
+ "cloud": "☁️",
657
+ "umbrella": "☔",
658
+ "zap": "⚡",
659
+ "snowflake": "❄️",
660
+ "sparkles": "✨",
661
+ "black_joker": "🃏",
662
+ "mahjong": "🀄",
663
+ "phone": "☎️",
664
+ "telephone": "☎️",
665
+ "envelope": "✉️",
666
+ "pencil2": "✏️",
667
+ "black_nib": "✒️",
668
+ "scissors": "✂️",
669
+ "wheelchair": "♿",
670
+ "warning": "⚠️",
671
+ "aries": "♈",
672
+ "taurus": "♉",
673
+ "gemini": "♊",
674
+ "cancer": "♋",
675
+ "leo": "♌",
676
+ "virgo": "♍",
677
+ "libra": "♎",
678
+ "scorpius": "♏",
679
+ "sagittarius": "♐",
680
+ "capricorn": "♑",
681
+ "aquarius": "♒",
682
+ "pisces": "♓",
683
+ "heavy_multiplication_x": "✖️",
684
+ "heavy_plus_sign": "➕",
685
+ "heavy_minus_sign": "➖",
686
+ "heavy_division_sign": "➗",
687
+ "bangbang": "‼️",
688
+ "interrobang": "⁉️",
689
+ "question": "❓",
690
+ "grey_question": "❔",
691
+ "grey_exclamation": "❕",
692
+ "exclamation": "❗",
693
+ "heavy_exclamation_mark": "❗",
694
+ "wavy_dash": "〰️",
695
+ "recycle": "♻️",
696
+ "white_check_mark": "✅",
697
+ "ballot_box_with_check": "☑️",
698
+ "heavy_check_mark": "✔️",
699
+ "x": "❌",
700
+ "negative_squared_cross_mark": "❎",
701
+ "curly_loop": "➰",
702
+ "loop": "➿",
703
+ "part_alternation_mark": "〽️",
704
+ "eight_spoked_asterisk": "✳️",
705
+ "eight_pointed_black_star": "✴️",
706
+ "sparkle": "❇️",
707
+ "copyright": "©️",
708
+ "registered": "®️",
709
+ "tm": "™️",
710
+ "information_source": "ℹ️",
711
+ "m": "Ⓜ️",
712
+ "black_circle": "⚫",
713
+ "white_circle": "⚪",
714
+ "black_large_square": "⬛",
715
+ "white_large_square": "⬜",
716
+ "black_medium_square": "◼️",
717
+ "white_medium_square": "◻️",
718
+ "black_medium_small_square": "◾",
719
+ "white_medium_small_square": "◽",
720
+ "black_small_square": "▪️",
721
+ "white_small_square": "▫️"
722
+ };
723
+
724
+
725
+ /* eslint-disable key-spacing */
726
+
727
+ var emojies_shortcuts = {
728
+ angry: ['>:(', '>:-('],
729
+ blush: [':")', ':-")'],
730
+ broken_heart: ['</3', '<\\3'],
731
+ confused: [':/', ':-/'],
732
+ cry: [":'(", ":'-(", ':,(', ':,-('],
733
+ frowning: [':(', ':-('],
734
+ heart: ['<3'],
735
+ imp: [']:(', ']:-('],
736
+ innocent: ['o:)', 'O:)', 'o:-)', 'O:-)', '0:)', '0:-)'],
737
+ joy: [":')", ":'-)", ':,)', ':,-)', ":'D", ":'-D", ':,D', ':,-D'],
738
+ kissing: [':*', ':-*'],
739
+ laughing: ['x-)', 'X-)'],
740
+ neutral_face: [':|', ':-|'],
741
+ open_mouth: [':o', ':-o', ':O', ':-O'],
742
+ rage: [':@', ':-@'],
743
+ smile: [':D', ':-D'],
744
+ smiley: [':)', ':-)'],
745
+ smiling_imp: [']:)', ']:-)'],
746
+ sob: [":,'(", ":,'-(", ';(', ';-('],
747
+ stuck_out_tongue: [':P', ':-P'],
748
+ sunglasses: ['8-)', 'B-)'],
749
+ sweat: [',:(', ',:-('],
750
+ sweat_smile: [',:)', ',:-)'],
751
+ unamused: [':s', ':-S', ':z', ':-Z', ':$', ':-$'],
752
+ wink: [';)', ';-)']
753
+ };
754
+
755
+ function emoji_html (tokens, idx ) {
756
+ return tokens[idx].content
757
+ }
758
+
759
+ function create_rule (md, emojies, shortcuts, scanRE, replaceRE) {
760
+ const arrayReplaceAt = md.utils.arrayReplaceAt;
761
+ const ucm = md.utils.lib.ucmicro;
762
+ const ZPCc = new RegExp([ucm.Z.source, ucm.P.source, ucm.Cc.source].join('|'));
763
+
764
+ function splitTextToken (text, level, Token) {
765
+ let last_pos = 0;
766
+ const nodes = [];
767
+
768
+ text.replace(replaceRE, function (match, offset, src) {
769
+ let emoji_name;
770
+ if (Object.prototype.hasOwnProperty.call(shortcuts, match)) {
771
+ emoji_name = shortcuts[match];
772
+
773
+ if (offset > 0 && !ZPCc.test(src[offset - 1])) return
774
+
775
+ if (offset + match.length < src.length && !ZPCc.test(src[offset + match.length])) {
776
+ return
777
+ }
778
+ } else {
779
+ emoji_name = match.slice(1, -1);
780
+ }
781
+
782
+ if (offset > last_pos) {
783
+ const token = new Token('text', '', 0);
784
+ token.content = text.slice(last_pos, offset);
785
+ nodes.push(token);
786
+ }
787
+
788
+ const token = new Token('emoji', '', 0);
789
+ token.markup = emoji_name;
790
+ token.content = emojies[emoji_name];
791
+ nodes.push(token);
792
+
793
+ last_pos = offset + match.length;
794
+ });
795
+
796
+ if (last_pos < text.length) {
797
+ const token = new Token('text', '', 0);
798
+ token.content = text.slice(last_pos);
799
+ nodes.push(token);
800
+ }
801
+
802
+ return nodes
803
+ }
804
+
805
+ return function emoji_replace (state) {
806
+ let token;
807
+ const blockTokens = state.tokens;
808
+ let autolinkLevel = 0;
809
+
810
+ for (let j = 0, l = blockTokens.length; j < l; j++) {
811
+ if (blockTokens[j].type !== 'inline') { continue }
812
+ let tokens = blockTokens[j].children;
813
+
814
+ for (let i = tokens.length - 1; i >= 0; i--) {
815
+ token = tokens[i];
816
+
817
+ if (token.type === 'link_open' || token.type === 'link_close') {
818
+ if (token.info === 'auto') { autolinkLevel -= token.nesting; }
819
+ }
820
+
821
+ if (token.type === 'text' && autolinkLevel === 0 && scanRE.test(token.content)) {
822
+ blockTokens[j].children = tokens = arrayReplaceAt(
823
+ tokens, i, splitTextToken(token.content, token.level, state.Token)
824
+ );
825
+ }
826
+ }
827
+ }
828
+ }
829
+ }
830
+
831
+
832
+ function quoteRE (str) {
833
+ return str.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&')
834
+ }
835
+
836
+ function normalize_opts (options) {
837
+ let emojies = options.defs;
838
+
839
+ if (options.enabled.length) {
840
+ emojies = Object.keys(emojies).reduce((acc, key) => {
841
+ if (options.enabled.indexOf(key) >= 0) acc[key] = emojies[key];
842
+ return acc
843
+ }, {});
844
+ }
845
+
846
+ const shortcuts = Object.keys(options.shortcuts).reduce((acc, key) => {
847
+ if (!emojies[key]) return acc
848
+
849
+ if (Array.isArray(options.shortcuts[key])) {
850
+ options.shortcuts[key].forEach(alias => { acc[alias] = key; });
851
+ return acc
852
+ }
853
+
854
+ acc[options.shortcuts[key]] = key;
855
+ return acc
856
+ }, {});
857
+
858
+ const keys = Object.keys(emojies);
859
+ let names;
860
+
861
+ if (keys.length === 0) {
862
+ names = '^$';
863
+ } else {
864
+ names = keys
865
+ .map(name => { return `:${name}:` })
866
+ .concat(Object.keys(shortcuts))
867
+ .sort()
868
+ .reverse()
869
+ .map(name => { return quoteRE(name) })
870
+ .join('|');
871
+ }
872
+ const scanRE = RegExp(names);
873
+ const replaceRE = RegExp(names, 'g');
874
+
875
+ return {
876
+ defs: emojies,
877
+ shortcuts,
878
+ scanRE,
879
+ replaceRE
880
+ }
881
+ }
882
+
883
+ function emoji_plugin$1 (md, options) {
884
+ const defaults = {
885
+ defs: {},
886
+ shortcuts: {},
887
+ enabled: []
888
+ };
889
+
890
+ const opts = normalize_opts(Object.assign({}, defaults, options || {}));
891
+
892
+ md.renderer.rules.emoji = emoji_html;
893
+
894
+ md.core.ruler.after(
895
+ 'linkify',
896
+ 'emoji',
897
+ create_rule(md, opts.defs, opts.shortcuts, opts.scanRE, opts.replaceRE)
898
+ );
899
+ }
900
+
901
+ function emoji_plugin (md, options) {
902
+ const defaults = {
903
+ defs: emojies_defs,
904
+ shortcuts: emojies_shortcuts,
905
+ enabled: []
906
+ };
907
+
908
+ const opts = Object.assign({}, defaults, options || {});
909
+
910
+ emoji_plugin$1(md, opts);
911
+ }
912
+
913
+ return emoji_plugin;
914
+
915
+ }));
18
916
  /*! markdown-it-abbr 2.0.0 https://github.com/markdown-it/markdown-it-abbr @license MIT */
19
- !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).markdownitAbbr=n()}(this,(function(){"use strict";return function(e){const n=e.utils.escapeRE,t=e.utils.arrayReplaceAt,r=" \r\n$+<=>^`|~",i=e.utils.lib.ucmicro.P.source,o=e.utils.lib.ucmicro.Z.source;e.block.ruler.before("reference","abbr_def",(function(e,n,t,r){let i,o=e.bMarks[n]+e.tShift[n];const s=e.eMarks[n];if(o+2>=s)return!1;if(42!==e.src.charCodeAt(o++))return!1;if(91!==e.src.charCodeAt(o++))return!1;const c=o;for(;o<s;o++){const n=e.src.charCodeAt(o);if(91===n)return!1;if(93===n){i=o;break}92===n&&o++}if(i<0||58!==e.src.charCodeAt(i+1))return!1;if(r)return!0;const l=e.src.slice(c,i).replace(/\\(.)/g,"$1"),a=e.src.slice(i+2,s).trim();return 0!==l.length&&(0!==a.length&&(e.env.abbreviations||(e.env.abbreviations={}),void 0===e.env.abbreviations[":"+l]&&(e.env.abbreviations[":"+l]=a),e.line=n+1,!0))}),{alt:["paragraph","reference"]}),e.core.ruler.after("linkify","abbr_replace",(function(e){const s=e.tokens;if(!e.env.abbreviations)return;const c=new RegExp("(?:"+Object.keys(e.env.abbreviations).map((function(e){return e.substr(1)})).sort((function(e,n){return n.length-e.length})).map(n).join("|")+")"),l="(^|"+i+"|"+o+"|["+r.split("").map(n).join("")+"])("+Object.keys(e.env.abbreviations).map((function(e){return e.substr(1)})).sort((function(e,n){return n.length-e.length})).map(n).join("|")+")($|"+i+"|"+o+"|["+r.split("").map(n).join("")+"])",a=new RegExp(l,"g");for(let n=0,r=s.length;n<r;n++){if("inline"!==s[n].type)continue;let r=s[n].children;for(let i=r.length-1;i>=0;i--){const o=r[i];if("text"!==o.type)continue;let l=0;const u=o.content;a.lastIndex=0;const f=[];if(!c.test(u))continue;let b;for(;b=a.exec(u);){if(b.index>0||b[1].length>0){const n=new e.Token("text","",0);n.content=u.slice(l,b.index+b[1].length),f.push(n)}const n=new e.Token("abbr_open","abbr",1);n.attrs=[["title",e.env.abbreviations[":"+b[2]]]],f.push(n);const t=new e.Token("text","",0);t.content=b[2],f.push(t);const r=new e.Token("abbr_close","abbr",-1);f.push(r),a.lastIndex-=b[3].length,l=a.lastIndex}if(f.length){if(l<u.length){const n=new e.Token("text","",0);n.content=u.slice(l),f.push(n)}s[n].children=r=t(r,i,f)}}}}))}}));
917
+ (function(global, factory) {
918
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
919
+ global.markdownitAbbr = factory());
920
+ })(this, (function() {
921
+ "use strict";
922
+
923
+ function abbr_plugin(md) {
924
+ const escapeRE = md.utils.escapeRE;
925
+ const arrayReplaceAt = md.utils.arrayReplaceAt;
926
+ const OTHER_CHARS = " \r\n$+<=>^`|~";
927
+ const UNICODE_PUNCT_RE = md.utils.lib.ucmicro.P.source;
928
+ const UNICODE_SPACE_RE = md.utils.lib.ucmicro.Z.source;
929
+ function abbr_def(state, startLine, endLine, silent) {
930
+ let labelEnd;
931
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
932
+ const max = state.eMarks[startLine];
933
+ if (pos + 2 >= max) {
934
+ return false;
935
+ }
936
+ if (state.src.charCodeAt(pos++) !== 42 ) {
937
+ return false;
938
+ }
939
+ if (state.src.charCodeAt(pos++) !== 91 ) {
940
+ return false;
941
+ }
942
+ const labelStart = pos;
943
+ for (;pos < max; pos++) {
944
+ const ch = state.src.charCodeAt(pos);
945
+ if (ch === 91 ) {
946
+ return false;
947
+ } else if (ch === 93 ) {
948
+ labelEnd = pos;
949
+ break;
950
+ } else if (ch === 92 ) {
951
+ pos++;
952
+ }
953
+ }
954
+ if (labelEnd < 0 || state.src.charCodeAt(labelEnd + 1) !== 58 ) {
955
+ return false;
956
+ }
957
+ if (silent) {
958
+ return true;
959
+ }
960
+ const label = state.src.slice(labelStart, labelEnd).replace(/\\(.)/g, "$1");
961
+ const title = state.src.slice(labelEnd + 2, max).trim();
962
+ if (label.length === 0) {
963
+ return false;
964
+ }
965
+ if (title.length === 0) {
966
+ return false;
967
+ }
968
+ if (!state.env.abbreviations) {
969
+ state.env.abbreviations = {};
970
+ }
971
+ if (typeof state.env.abbreviations[":" + label] === "undefined") {
972
+ state.env.abbreviations[":" + label] = title;
973
+ }
974
+ state.line = startLine + 1;
975
+ return true;
976
+ }
977
+ function abbr_replace(state) {
978
+ const blockTokens = state.tokens;
979
+ if (!state.env.abbreviations) {
980
+ return;
981
+ }
982
+ const regSimple = new RegExp("(?:" + Object.keys(state.env.abbreviations).map((function(x) {
983
+ return x.substr(1);
984
+ })).sort((function(a, b) {
985
+ return b.length - a.length;
986
+ })).map(escapeRE).join("|") + ")");
987
+ const regText = "(^|" + UNICODE_PUNCT_RE + "|" + UNICODE_SPACE_RE + "|[" + OTHER_CHARS.split("").map(escapeRE).join("") + "])" + "(" + Object.keys(state.env.abbreviations).map((function(x) {
988
+ return x.substr(1);
989
+ })).sort((function(a, b) {
990
+ return b.length - a.length;
991
+ })).map(escapeRE).join("|") + ")" + "($|" + UNICODE_PUNCT_RE + "|" + UNICODE_SPACE_RE + "|[" + OTHER_CHARS.split("").map(escapeRE).join("") + "])";
992
+ const reg = new RegExp(regText, "g");
993
+ for (let j = 0, l = blockTokens.length; j < l; j++) {
994
+ if (blockTokens[j].type !== "inline") {
995
+ continue;
996
+ }
997
+ let tokens = blockTokens[j].children;
998
+ for (let i = tokens.length - 1; i >= 0; i--) {
999
+ const currentToken = tokens[i];
1000
+ if (currentToken.type !== "text") {
1001
+ continue;
1002
+ }
1003
+ let pos = 0;
1004
+ const text = currentToken.content;
1005
+ reg.lastIndex = 0;
1006
+ const nodes = [];
1007
+ if (!regSimple.test(text)) {
1008
+ continue;
1009
+ }
1010
+ let m;
1011
+ while (m = reg.exec(text)) {
1012
+ if (m.index > 0 || m[1].length > 0) {
1013
+ const token = new state.Token("text", "", 0);
1014
+ token.content = text.slice(pos, m.index + m[1].length);
1015
+ nodes.push(token);
1016
+ }
1017
+ const token_o = new state.Token("abbr_open", "abbr", 1);
1018
+ token_o.attrs = [ [ "title", state.env.abbreviations[":" + m[2]] ] ];
1019
+ nodes.push(token_o);
1020
+ const token_t = new state.Token("text", "", 0);
1021
+ token_t.content = m[2];
1022
+ nodes.push(token_t);
1023
+ const token_c = new state.Token("abbr_close", "abbr", -1);
1024
+ nodes.push(token_c);
1025
+ reg.lastIndex -= m[3].length;
1026
+ pos = reg.lastIndex;
1027
+ }
1028
+ if (!nodes.length) {
1029
+ continue;
1030
+ }
1031
+ if (pos < text.length) {
1032
+ const token = new state.Token("text", "", 0);
1033
+ token.content = text.slice(pos);
1034
+ nodes.push(token);
1035
+ }
1036
+ blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
1037
+ }
1038
+ }
1039
+ }
1040
+ md.block.ruler.before("reference", "abbr_def", abbr_def, {
1041
+ alt: [ "paragraph", "reference" ]
1042
+ });
1043
+ md.core.ruler.after("linkify", "abbr_replace", abbr_replace);
1044
+ }
1045
+ return abbr_plugin;
1046
+ }));
20
1047
  /*! markdown-it-ins 4.0.0 https://github.com/markdown-it/markdown-it-ins @license MIT */
21
- !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).markdownitIns=n()}(this,(function(){"use strict";return function(e){function n(e,n){let t;const o=[],s=n.length;for(let i=0;i<s;i++){const s=n[i];if(43!==s.marker)continue;if(-1===s.end)continue;const r=n[s.end];t=e.tokens[s.token],t.type="ins_open",t.tag="ins",t.nesting=1,t.markup="++",t.content="",t=e.tokens[r.token],t.type="ins_close",t.tag="ins",t.nesting=-1,t.markup="++",t.content="","text"===e.tokens[r.token-1].type&&"+"===e.tokens[r.token-1].content&&o.push(r.token-1)}for(;o.length;){const n=o.pop();let s=n+1;for(;s<e.tokens.length&&"ins_close"===e.tokens[s].type;)s++;s--,n!==s&&(t=e.tokens[s],e.tokens[s]=e.tokens[n],e.tokens[n]=t)}}e.inline.ruler.before("emphasis","ins",(function(e,n){const t=e.pos,o=e.src.charCodeAt(t);if(n)return!1;if(43!==o)return!1;const s=e.scanDelims(e.pos,!0);let i=s.length;const r=String.fromCharCode(o);if(i<2)return!1;if(i%2){e.push("text","",0).content=r,i--}for(let n=0;n<i;n+=2){e.push("text","",0).content=r+r,(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","ins",(function(e){const t=e.tokens_meta,o=(e.tokens_meta||[]).length;n(e,e.delimiters);for(let s=0;s<o;s++)t[s]&&t[s].delimiters&&n(e,t[s].delimiters)}))}}));
1048
+ (function(global, factory) {
1049
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
1050
+ global.markdownitIns = factory());
1051
+ })(this, (function() {
1052
+ "use strict";
1053
+ function ins_plugin(md) {
1054
+ function tokenize(state, silent) {
1055
+ const start = state.pos;
1056
+ const marker = state.src.charCodeAt(start);
1057
+ if (silent) {
1058
+ return false;
1059
+ }
1060
+ if (marker !== 43 ) {
1061
+ return false;
1062
+ }
1063
+ const scanned = state.scanDelims(state.pos, true);
1064
+ let len = scanned.length;
1065
+ const ch = String.fromCharCode(marker);
1066
+ if (len < 2) {
1067
+ return false;
1068
+ }
1069
+ if (len % 2) {
1070
+ const token = state.push("text", "", 0);
1071
+ token.content = ch;
1072
+ len--;
1073
+ }
1074
+ for (let i = 0; i < len; i += 2) {
1075
+ const token = state.push("text", "", 0);
1076
+ token.content = ch + ch;
1077
+ if (!scanned.can_open && !scanned.can_close) {
1078
+ continue;
1079
+ }
1080
+ state.delimiters.push({
1081
+ marker: marker,
1082
+ length: 0,
1083
+ jump: i / 2,
1084
+ token: state.tokens.length - 1,
1085
+ end: -1,
1086
+ open: scanned.can_open,
1087
+ close: scanned.can_close
1088
+ });
1089
+ }
1090
+ state.pos += scanned.length;
1091
+ return true;
1092
+ }
1093
+
1094
+ function postProcess(state, delimiters) {
1095
+ let token;
1096
+ const loneMarkers = [];
1097
+ const max = delimiters.length;
1098
+ for (let i = 0; i < max; i++) {
1099
+ const startDelim = delimiters[i];
1100
+ if (startDelim.marker !== 43 ) {
1101
+ continue;
1102
+ }
1103
+ if (startDelim.end === -1) {
1104
+ continue;
1105
+ }
1106
+ const endDelim = delimiters[startDelim.end];
1107
+ token = state.tokens[startDelim.token];
1108
+ token.type = "ins_open";
1109
+ token.tag = "ins";
1110
+ token.nesting = 1;
1111
+ token.markup = "++";
1112
+ token.content = "";
1113
+ token = state.tokens[endDelim.token];
1114
+ token.type = "ins_close";
1115
+ token.tag = "ins";
1116
+ token.nesting = -1;
1117
+ token.markup = "++";
1118
+ token.content = "";
1119
+ if (state.tokens[endDelim.token - 1].type === "text" && state.tokens[endDelim.token - 1].content === "+") {
1120
+ loneMarkers.push(endDelim.token - 1);
1121
+ }
1122
+ }
1123
+
1124
+
1125
+ while (loneMarkers.length) {
1126
+ const i = loneMarkers.pop();
1127
+ let j = i + 1;
1128
+ while (j < state.tokens.length && state.tokens[j].type === "ins_close") {
1129
+ j++;
1130
+ }
1131
+ j--;
1132
+ if (i !== j) {
1133
+ token = state.tokens[j];
1134
+ state.tokens[j] = state.tokens[i];
1135
+ state.tokens[i] = token;
1136
+ }
1137
+ }
1138
+ }
1139
+ md.inline.ruler.before("emphasis", "ins", tokenize);
1140
+ md.inline.ruler2.before("emphasis", "ins", (function(state) {
1141
+ const tokens_meta = state.tokens_meta;
1142
+ const max = (state.tokens_meta || []).length;
1143
+ postProcess(state, state.delimiters);
1144
+ for (let curr = 0; curr < max; curr++) {
1145
+ if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
1146
+ postProcess(state, tokens_meta[curr].delimiters);
1147
+ }
1148
+ }
1149
+ }));
1150
+ }
1151
+ return ins_plugin;
1152
+ }));
22
1153
  /*! markdown-it-deflist 4.0.0 https://github.com/markdown-it/markdown-it-deflist.git @license MIT */
23
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).markdownitDeflist=e()}(this,function(){"use strict";const t=Symbol("markdown-it-deflist.ddDepth");return function(e){const n=e.utils.isSpace;function o(t,e){let n=t.bMarks[e]+t.tShift[e];const o=t.eMarks[e];if(n>=o)return-1;if(t.sCount[e]-t.blkIndent>=4)return-1;const r=t.src.charCodeAt(n++);if(126!==r&&58!==r)return-1;const i=t.skipSpaces(n);return n<o&&n===i?-1:n}function r(t,e,n,o){let r=-1;for(let i=e;i<n;i++){const e=t.tokens[i];if(e.level===o&&e.block&&!(e.nesting<0)){if(r>=0)return;r=i}}r<0||"paragraph_open"!==t.tokens[r].type||(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0)}e.block.ruler.before("paragraph","deflist",function(e,i,s,l){if(l){if(!e.env[t])return!1;return o(e,i)>=0&&e.sCount[i]<e.blkIndent}let f=i+1;if(f>=s)return!1;let d=!0;if(e.isEmpty(f)&&(f++,d=!1,f>=s))return!1;if(e.sCount[f]<e.blkIndent)return!1;let u=o(e,f);if(u<0)return!1;const a=[i,0];e.push("dl_open","dl",1).map=a;let p=i,k=f;t:for(;;){e.push("dt_open","dt",1).map=[p,p];const i=e.push("inline","",0);for(i.map=[p,p],i.content=e.getLines(p,p+1,e.blkIndent,!1).trim(),i.children=[],e.push("dt_close","dt",-1);;){const i=e.tokens.length,l=e.push("dd_open","dd",1),a=[f,0];l.map=a;let p=u;const c=e.eMarks[k];let b=e.sCount[k]+u-(e.bMarks[k]+e.tShift[k]);for(;p<c;){const t=e.src.charCodeAt(p);if(!n(t))break;9===t?b+=4-b%4:b++,p++}u=p;const h=e.tight,m=e.blkIndent,C=e.tShift[k],g=e.sCount[k],y=e.parentType;if(e.blkIndent=e.sCount[k]+2,e.tShift[k]=u-e.bMarks[k],e.sCount[k]=b,e.tight=!0,e.parentType="deflist",e.env[t]=(e.env[t]||0)+1,e.md.block.tokenize(e,k,s,!0),e.env[t]--,d&&r(e,i,e.tokens.length,l.level+1),e.tShift[k]=C,e.sCount[k]=g,e.tight=h,e.parentType=y,e.blkIndent=m,e.push("dd_close","dd",-1),a[1]=f=e.line,f>=s)break t;if(e.sCount[f]<e.blkIndent)break t;if(u=o(e,f),u<0)break;k=f}if(f>=s)break;if(p=f,e.isEmpty(p))break;if(e.sCount[p]<e.blkIndent)break;if(k=p+1,k>=s)break;const l=e.isEmpty(k);if(l&&k++,k>=s)break;if(e.sCount[k]<e.blkIndent)break;if(u=o(e,k),u<0)break;d=!l}return e.push("dl_close","dl",-1),a[1]=f,e.line=f,!0},{alt:["paragraph","reference","blockquote"]})}});
24
-
1154
+ (function(global, factory) {
1155
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
1156
+ global.markdownitDeflist = factory());
1157
+ })(this, function() {
1158
+ "use strict";
1159
+
1160
+ const ddDepthKey = Symbol("markdown-it-deflist.ddDepth");
1161
+ function deflist_plugin(md) {
1162
+ const isSpace = md.utils.isSpace;
1163
+ function skipMarker(state, line) {
1164
+ let start = state.bMarks[line] + state.tShift[line];
1165
+ const max = state.eMarks[line];
1166
+ if (start >= max) {
1167
+ return -1;
1168
+ }
1169
+ if (state.sCount[line] - state.blkIndent >= 4) {
1170
+ return -1;
1171
+ }
1172
+ const marker = state.src.charCodeAt(start++);
1173
+ if (marker !== 126 && marker !== 58 ) {
1174
+ return -1;
1175
+ }
1176
+ const pos = state.skipSpaces(start);
1177
+ if (start < max && start === pos) {
1178
+ return -1;
1179
+ }
1180
+ return start;
1181
+ }
1182
+ function markTightParagraph(state, start, end, level) {
1183
+ let block = -1;
1184
+ for (let i = start; i < end; i++) {
1185
+ const token = state.tokens[i];
1186
+ if (token.level !== level || !token.block || token.nesting < 0) {
1187
+ continue;
1188
+ }
1189
+ if (block >= 0) {
1190
+ return;
1191
+ }
1192
+ block = i;
1193
+ }
1194
+ if (block < 0 || state.tokens[block].type !== "paragraph_open") {
1195
+ return;
1196
+ }
1197
+ state.tokens[block + 2].hidden = true;
1198
+ state.tokens[block].hidden = true;
1199
+ }
1200
+ function deflist(state, startLine, endLine, silent) {
1201
+ if (silent) {
1202
+ if (!state.env[ddDepthKey]) {
1203
+ return false;
1204
+ }
1205
+ const markerPos = skipMarker(state, startLine);
1206
+ return markerPos >= 0 && state.sCount[startLine] < state.blkIndent;
1207
+ }
1208
+ let nextLine = startLine + 1;
1209
+ if (nextLine >= endLine) {
1210
+ return false;
1211
+ }
1212
+ let termIsTight = true;
1213
+ if (state.isEmpty(nextLine)) {
1214
+ nextLine++;
1215
+ termIsTight = false;
1216
+ if (nextLine >= endLine) {
1217
+ return false;
1218
+ }
1219
+ }
1220
+ if (state.sCount[nextLine] < state.blkIndent) {
1221
+ return false;
1222
+ }
1223
+ let contentStart = skipMarker(state, nextLine);
1224
+ if (contentStart < 0) {
1225
+ return false;
1226
+ }
1227
+ const token_dl_o = state.push("dl_open", "dl", 1);
1228
+ const listLines = [ startLine, 0 ];
1229
+ token_dl_o.map = listLines;
1230
+
1231
+
1232
+ let dtLine = startLine;
1233
+ let ddLine = nextLine;
1234
+
1235
+
1236
+ /* eslint no-labels:0,block-scoped-var:0 */ OUTER: for (;;) {
1237
+ const token_dt_o = state.push("dt_open", "dt", 1);
1238
+ token_dt_o.map = [ dtLine, dtLine ];
1239
+ const token_i = state.push("inline", "", 0);
1240
+ token_i.map = [ dtLine, dtLine ];
1241
+ token_i.content = state.getLines(dtLine, dtLine + 1, state.blkIndent, false).trim();
1242
+ token_i.children = [];
1243
+ state.push("dt_close", "dt", -1);
1244
+ for (;;) {
1245
+ const itemTokIdx = state.tokens.length;
1246
+ const token_dd_o = state.push("dd_open", "dd", 1);
1247
+ const itemLines = [ nextLine, 0 ];
1248
+ token_dd_o.map = itemLines;
1249
+ let pos = contentStart;
1250
+ const max = state.eMarks[ddLine];
1251
+ let offset = state.sCount[ddLine] + contentStart - (state.bMarks[ddLine] + state.tShift[ddLine]);
1252
+ while (pos < max) {
1253
+ const ch = state.src.charCodeAt(pos);
1254
+ if (isSpace(ch)) {
1255
+ if (ch === 9) {
1256
+ offset += 4 - offset % 4;
1257
+ } else {
1258
+ offset++;
1259
+ }
1260
+ } else {
1261
+ break;
1262
+ }
1263
+ pos++;
1264
+ }
1265
+ contentStart = pos;
1266
+ const oldTight = state.tight;
1267
+ const oldIndent = state.blkIndent;
1268
+ const oldTShift = state.tShift[ddLine];
1269
+ const oldSCount = state.sCount[ddLine];
1270
+ const oldParentType = state.parentType;
1271
+ state.blkIndent = state.sCount[ddLine] + 2;
1272
+ state.tShift[ddLine] = contentStart - state.bMarks[ddLine];
1273
+ state.sCount[ddLine] = offset;
1274
+ state.tight = true;
1275
+ state.parentType = "deflist";
1276
+ state.env[ddDepthKey] = (state.env[ddDepthKey] || 0) + 1;
1277
+ state.md.block.tokenize(state, ddLine, endLine, true);
1278
+ state.env[ddDepthKey]--;
1279
+ if (termIsTight) {
1280
+ markTightParagraph(state, itemTokIdx, state.tokens.length, token_dd_o.level + 1);
1281
+ }
1282
+ state.tShift[ddLine] = oldTShift;
1283
+ state.sCount[ddLine] = oldSCount;
1284
+ state.tight = oldTight;
1285
+ state.parentType = oldParentType;
1286
+ state.blkIndent = oldIndent;
1287
+ state.push("dd_close", "dd", -1);
1288
+ itemLines[1] = nextLine = state.line;
1289
+ if (nextLine >= endLine) {
1290
+ break OUTER;
1291
+ }
1292
+ if (state.sCount[nextLine] < state.blkIndent) {
1293
+ break OUTER;
1294
+ }
1295
+ contentStart = skipMarker(state, nextLine);
1296
+ if (contentStart < 0) {
1297
+ break;
1298
+ }
1299
+ ddLine = nextLine;
1300
+ }
1301
+ if (nextLine >= endLine) {
1302
+ break;
1303
+ }
1304
+ dtLine = nextLine;
1305
+ if (state.isEmpty(dtLine)) {
1306
+ break;
1307
+ }
1308
+ if (state.sCount[dtLine] < state.blkIndent) {
1309
+ break;
1310
+ }
1311
+ ddLine = dtLine + 1;
1312
+ if (ddLine >= endLine) {
1313
+ break;
1314
+ }
1315
+ const skippedEmptyLine = state.isEmpty(ddLine);
1316
+ if (skippedEmptyLine) {
1317
+ ddLine++;
1318
+ }
1319
+ if (ddLine >= endLine) {
1320
+ break;
1321
+ }
1322
+ if (state.sCount[ddLine] < state.blkIndent) {
1323
+ break;
1324
+ }
1325
+ contentStart = skipMarker(state, ddLine);
1326
+ if (contentStart < 0) {
1327
+ break;
1328
+ }
1329
+ termIsTight = !skippedEmptyLine;
1330
+ }
1331
+ state.push("dl_close", "dl", -1);
1332
+ listLines[1] = nextLine;
1333
+ state.line = nextLine;
1334
+ return true;
1335
+ }
1336
+ md.block.ruler.before("paragraph", "deflist", deflist, {
1337
+ alt: [ "paragraph", "reference", "blockquote" ]
1338
+ });
1339
+ }
1340
+ return deflist_plugin;
1341
+ });
25
1342
  }
26
1343
  return Object.freeze(root);
27
1344
  }