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 • 3.03 kB
Source Map (JSON)
{"version":3,"file":"parse_link_title.mjs","sources":["../../../../../../node_modules/markdown-it/lib/helpers/parse_link_title.mjs"],"sourcesContent":["// Parse link title\n//\n\nimport { unescapeAll } from '../common/utils.mjs'\n\n// Parse link title within `str` in [start, max] range,\n// or continue previous parsing if `prev_state` is defined (equal to result of last execution).\n//\nexport default function parseLinkTitle (str, start, max, prev_state) {\n let code\n let pos = start\n\n const state = {\n // if `true`, this is a valid link title\n ok: false,\n // if `true`, this link can be continued on the next line\n can_continue: false,\n // if `ok`, it's the position of the first character after the closing marker\n pos: 0,\n // if `ok`, it's the unescaped title\n str: '',\n // expected closing marker character code\n marker: 0\n }\n\n if (prev_state) {\n // this is a continuation of a previous parseLinkTitle call on the next line,\n // used in reference links only\n state.str = prev_state.str\n state.marker = prev_state.marker\n } else {\n if (pos >= max) { return state }\n\n let marker = str.charCodeAt(pos)\n if (marker !== 0x22 /* \" */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return state }\n\n start++\n pos++\n\n // if opening marker is \"(\", switch it to closing marker \")\"\n if (marker === 0x28) { marker = 0x29 }\n\n state.marker = marker\n }\n\n while (pos < max) {\n code = str.charCodeAt(pos)\n if (code === state.marker) {\n state.pos = pos + 1\n state.str += unescapeAll(str.slice(start, pos))\n state.ok = true\n return state\n } else if (code === 0x28 /* ( */ && state.marker === 0x29 /* ) */) {\n return state\n } else if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos++\n }\n\n pos++\n }\n\n // no closing marker found, but this link title may continue on the next line (for references)\n state.can_continue = true\n state.str += unescapeAll(str.slice(start, pos))\n return state\n}\n"],"names":["parseLinkTitle","str","start","max","prev_state","code","pos","state","marker","unescapeAll"],"mappings":";AAQe,SAASA,EAAgBC,GAAKC,GAAOC,GAAKC,GAAY;AACnE,MAAIC,GACAC,IAAMJ;AAEV,QAAMK,IAAQ;AAAA;AAAA,IAEZ,IAAI;AAAA;AAAA,IAEJ,cAAc;AAAA;AAAA,IAEd,KAAK;AAAA;AAAA,IAEL,KAAK;AAAA;AAAA,IAEL,QAAQ;AAAA,EACZ;AAEE,MAAIH;AAGF,IAAAG,EAAM,MAAMH,EAAW,KACvBG,EAAM,SAASH,EAAW;AAAA,OACrB;AACL,QAAIE,KAAOH;AAAO,aAAOI;AAEzB,QAAIC,IAASP,EAAI,WAAWK,CAAG;AAC/B,QAAIE,MAAW,MAAgBA,MAAW,MAAgBA,MAAW;AAAgB,aAAOD;AAE5F,IAAAL,KACAI,KAGIE,MAAW,OAAQA,IAAS,KAEhCD,EAAM,SAASC;AAAA,EACjB;AAEA,SAAOF,IAAMH,KAAK;AAEhB,QADAE,IAAOJ,EAAI,WAAWK,CAAG,GACrBD,MAASE,EAAM;AACjB,aAAAA,EAAM,MAAMD,IAAM,GAClBC,EAAM,OAAOE,EAAYR,EAAI,MAAMC,GAAOI,CAAG,CAAC,GAC9CC,EAAM,KAAK,IACJA;AACF,QAAIF,MAAS,MAAgBE,EAAM,WAAW;AACnD,aAAOA;AACF,IAAIF,MAAS,MAAgBC,IAAM,IAAIH,KAC5CG,KAGFA;AAAA,EACF;AAGA,SAAAC,EAAM,eAAe,IACrBA,EAAM,OAAOE,EAAYR,EAAI,MAAMC,GAAOI,CAAG,CAAC,GACvCC;AACT;","x_google_ignoreList":[0]}