rittenhop-dev/versions/5.94.2/node_modules/markdown-it-sub/dist/markdown-it-sub.min.js

3 lines
967 B
JavaScript
Raw Normal View History

2024-09-23 19:40:12 -04:00
/*! markdown-it-sub 2.0.0 https://github.com/markdown-it/markdown-it-sub @license MIT */
!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).markdownitSub=s()}(this,(function(){"use strict";const e=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;function s(s,o){const n=s.posMax,t=s.pos;if(126!==s.src.charCodeAt(t))return!1;if(o)return!1;if(t+2>=n)return!1;s.pos=t+1;let r=!1;for(;s.pos<n;){if(126===s.src.charCodeAt(s.pos)){r=!0;break}s.md.inline.skipToken(s)}if(!r||t+1===s.pos)return s.pos=t,!1;const p=s.src.slice(t+1,s.pos);if(p.match(/(^|[^\\])(\\\\)*\s/))return s.pos=t,!1;s.posMax=s.pos,s.pos=t+1;s.push("sub_open","sub",1).markup="~";s.push("text","",0).content=p.replace(e,"$1");return s.push("sub_close","sub",-1).markup="~",s.pos=s.posMax+1,s.posMax=n,!0}return function(e){e.inline.ruler.after("emphasis","sub",s)}}));