75a0e36c1769f500c91572a5594861cbb155669c6aeda2b607d174ee3c3a5ff9.json 5.7 KB

1
  1. {"ast":null,"code":"// 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 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 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) {\n return state;\n }\n let marker = str.charCodeAt(pos);\n if (marker !== 0x22 /* \" */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) {\n return state;\n }\n start++;\n pos++;\n\n // if opening marker is \"(\", switch it to closing marker \")\"\n if (marker === 0x28) {\n marker = 0x29;\n }\n state.marker = marker;\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 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}","map":{"version":3,"names":["unescapeAll","parseLinkTitle","str","start","max","prev_state","code","pos","state","ok","can_continue","marker","charCodeAt","slice"],"sources":["F:/workspace/202226701027/huinongbao-app/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"],"mappings":"AAAA;AACA;;AAEA,SAASA,WAAW,QAAQ,qBAAqB;;AAEjD;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAAEC,GAAG,EAAEC,KAAK,EAAEC,GAAG,EAAEC,UAAU,EAAE;EACnE,IAAIC,IAAI;EACR,IAAIC,GAAG,GAAGJ,KAAK;EAEf,MAAMK,KAAK,GAAG;IACZ;IACAC,EAAE,EAAE,KAAK;IACT;IACAC,YAAY,EAAE,KAAK;IACnB;IACAH,GAAG,EAAE,CAAC;IACN;IACAL,GAAG,EAAE,EAAE;IACP;IACAS,MAAM,EAAE;EACV,CAAC;EAED,IAAIN,UAAU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