UNPKG

vue-files-preview-inno

Version:

A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.

1 lines 2.07 kB
{"version":3,"file":"text_join.mjs","sources":["../../../../../../node_modules/markdown-it/lib/rules_core/text_join.mjs"],"sourcesContent":["// Join raw text tokens with the rest of the text\n//\n// This is set as a separate rule to provide an opportunity for plugins\n// to run text replacements after text join, but before escape join.\n//\n// For example, `\\:)` shouldn't be replaced with an emoji.\n//\n\nexport default function text_join (state) {\n let curr, last\n const blockTokens = state.tokens\n const l = blockTokens.length\n\n for (let j = 0; j < l; j++) {\n if (blockTokens[j].type !== 'inline') continue\n\n const tokens = blockTokens[j].children\n const max = tokens.length\n\n for (curr = 0; curr < max; curr++) {\n if (tokens[curr].type === 'text_special') {\n tokens[curr].type = 'text'\n }\n }\n\n for (curr = last = 0; curr < max; curr++) {\n if (tokens[curr].type === 'text' &&\n curr + 1 < max &&\n tokens[curr + 1].type === 'text') {\n // collapse two adjacent text nodes\n tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content\n } else {\n if (curr !== last) { tokens[last] = tokens[curr] }\n\n last++\n }\n }\n\n if (curr !== last) {\n tokens.length = last\n }\n }\n}\n"],"names":["text_join","state","curr","last","blockTokens","l","j","tokens","max"],"mappings":"AAQe,SAASA,EAAWC,GAAO;AACxC,MAAIC,GAAMC;AACV,QAAMC,IAAcH,EAAM,QACpBI,IAAID,EAAY;AAEtB,WAASE,IAAI,GAAGA,IAAID,GAAGC,KAAK;AAC1B,QAAIF,EAAYE,CAAC,EAAE,SAAS,SAAU;AAEtC,UAAMC,IAASH,EAAYE,CAAC,EAAE,UACxBE,IAAMD,EAAO;AAEnB,SAAKL,IAAO,GAAGA,IAAOM,GAAKN;AACzB,MAAIK,EAAOL,CAAI,EAAE,SAAS,mBACxBK,EAAOL,CAAI,EAAE,OAAO;AAIxB,SAAKA,IAAOC,IAAO,GAAGD,IAAOM,GAAKN;AAChC,MAAIK,EAAOL,CAAI,EAAE,SAAS,UACtBA,IAAO,IAAIM,KACXD,EAAOL,IAAO,CAAC,EAAE,SAAS,SAE5BK,EAAOL,IAAO,CAAC,EAAE,UAAUK,EAAOL,CAAI,EAAE,UAAUK,EAAOL,IAAO,CAAC,EAAE,WAE/DA,MAASC,MAAQI,EAAOJ,CAAI,IAAII,EAAOL,CAAI,IAE/CC;AAIJ,IAAID,MAASC,MACXI,EAAO,SAASJ;AAAA,EAEpB;AACF;","x_google_ignoreList":[0]}