You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parttimejob/node_modules/markdown-it-footnote/dist/markdown-it-footnote.min.js

3 lines
5.4 KiB

4 weeks ago
/*! markdown-it-footnote 2.0.0 https://github.com//markdown-it/markdown-it-footnote @license MIT */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;o="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,o.markdownitFootnote=e()}}(function(){return function e(o,t,n){function r(f,i){if(!t[f]){if(!o[f]){var u="function"==typeof require&&require;if(!i&&u)return u(f,!0);if(s)return s(f,!0);var l=new Error("Cannot find module '"+f+"'");throw l.code="MODULE_NOT_FOUND",l}var a=t[f]={exports:{}};o[f][0].call(a.exports,function(e){var t=o[f][1][e];return r(t?t:e)},a,a.exports,e,o,t,n)}return t[f].exports}for(var s="function"==typeof require&&require,f=0;f<n.length;f++)r(n[f]);return r}({1:[function(e,o,t){"use strict";function n(e,o){var t=Number(e[o].meta.id+1).toString(),n="fnref"+t;return e[o].meta.subId>0&&(n+=":"+e[o].meta.subId),'<sup class="footnote-ref"><a href="#fn'+t+'" id="'+n+'">['+t+"]</a></sup>"}function r(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 s(){return"</ol>\n</section>\n"}function f(e,o){var t=Number(e[o].meta.id+1).toString();return'<li id="fn'+t+'" class="footnote-item">'}function i(){return"</li>\n"}function u(e,o){var t=Number(e[o].meta.id+1).toString(),n="fnref"+t;return e[o].meta.subId>0&&(n+=":"+e[o].meta.subId),' <a href="#'+n+'" class="footnote-backref">\u21a9</a>'}o.exports=function(e){function o(e,o,t,n){var r,s,f,i,u,l,a,c,d,h,k,v=e.bMarks[o]+e.tShift[o],b=e.eMarks[o];if(v+4>b)return!1;if(91!==e.src.charCodeAt(v))return!1;if(94!==e.src.charCodeAt(v+1))return!1;for(u=v+2;b>u;u++){if(32===e.src.charCodeAt(u))return!1;if(93===e.src.charCodeAt(u))break}if(u===v+2)return!1;if(u+1>=b||58!==e.src.charCodeAt(++u))return!1;if(n)return!0;for(u++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={}),l=e.src.slice(v+2,u-2),e.env.footnotes.refs[":"+l]=-1,a=new e.Token("footnote_reference_open","",1),a.meta={label:l},a.level=e.level++,e.tokens.push(a),r=e.bMarks[o],s=e.tShift[o],f=e.sCount[o],i=e.parentType,k=u,c=d=e.sCount[o]+u-(e.bMarks[o]+e.tShift[o]);b>u&&(h=e.src.charCodeAt(u),p(h));)9===h?d+=4-d%4:d++,u++;return e.tShift[o]=u-k,e.sCount[o]=d-c,e.bMarks[o]=k,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=i,e.blkIndent-=4,e.tShift[o]=s,e.sCount[o]=f,e.bMarks[o]=r,a=new e.Token("footnote_reference_close","",-1),a.level=--e.level,e.tokens.push(a),!0}function t(e,o){var t,n,r,s,f,i=e.posMax,u=e.pos;return u+2>=i?!1:94!==e.src.charCodeAt(u)?!1:91!==e.src.charCodeAt(u+1)?!1:(t=u+2,n=c(e,u+1),0>n?!1:(o||(e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]),r=e.env.footnotes.list.length,e.md.inline.parse(e.src.slice(t,n),e.md,e.env,f=[]),s=e.push("footnote_ref","",0),s.meta={id:r},e.env.footnotes.list[r]={tokens:f}),e.pos=n+1,e.posMax=i,!0))}function l(e,o){var t,n,r,s,f,i=e.posMax,u=e.pos;if(u+3>i)return!1;if(!e.env.footnotes||!e.env.footnotes.refs)return!1;if(91!==e.src.charCodeAt(u))return!1;if(94!==e.src.charCodeAt(u+1))return!1;for(n=u+2;i>n;n++){if(32===e.src.charCodeAt(n))return!1;if(10===e.src.charCodeAt(n))return!1;if(93===e.src.charCodeAt(n))break}return n===u+2?!1:n>=i?!1:(n++,t=e.src.slice(u+2,n-1),"undefined"==typeof e.env.footnotes.refs[":"+t]?!1:(o||(e.env.footnotes.list||(e.env.footnotes.list=[]),e.env.footnotes.refs[":"+t]<0?(r=e.env.footnotes.list.length,e.env.footnotes.list[r]={label:t,count:0},e.env.footnotes.refs[":"+t]=r):r=e.env.footnotes.refs[":"+t],s=e.env.footnotes.list[r].count,e.env.footnotes.list[r].count++,f=e.push("footnote_ref","",0),f.meta={id:r,subId:s}),e.pos=n,e.posMax=i,!0))}function a(e){var o,t,n,r,s,f,i,u,l,a,c=!1,p={};if(e.env.footnotes&&(e.tokens=e.tokens.filter(function(e){return"footnote_reference_open"===e.type?(c=!0,l=[],a=e.meta.label,!1):"footnote_reference_close"===e.type?(c=!1,p[":"+a]=l,!1):(c&&l.push(e),!c)}),e.env.footnotes.list)){for(f=