b095b47d5ee7a230a2d932bce75c21d7138fe9a7cab74fff45bf68614fadcd94.json 5.1 KB

1
  1. {"ast":null,"code":"// Process escaped chars and hardbreaks\n\nimport { isSpace } from '../common/utils.mjs';\nconst ESCAPED = [];\nfor (let i = 0; i < 256; i++) {\n ESCAPED.push(0);\n}\n'\\\\!\"#$%&\\'()*+,./:;<=>?@[]^_`{|}~-'.split('').forEach(function (ch) {\n ESCAPED[ch.charCodeAt(0)] = 1;\n});\nexport default function escape(state, silent) {\n let pos = state.pos;\n const max = state.posMax;\n if (state.src.charCodeAt(pos) !== 0x5C /* \\ */) return false;\n pos++;\n\n // '\\' at the end of the inline block\n if (pos >= max) return false;\n let ch1 = state.src.charCodeAt(pos);\n if (ch1 === 0x0A) {\n if (!silent) {\n state.push('hardbreak', 'br', 0);\n }\n pos++;\n // skip leading whitespaces from next line\n while (pos < max) {\n ch1 = state.src.charCodeAt(pos);\n if (!isSpace(ch1)) break;\n pos++;\n }\n state.pos = pos;\n return true;\n }\n let escapedStr = state.src[pos];\n if (ch1 >= 0xD800 && ch1 <= 0xDBFF && pos + 1 < max) {\n const ch2 = state.src.charCodeAt(pos + 1);\n if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {\n escapedStr += state.src[pos + 1];\n pos++;\n }\n }\n const origStr = '\\\\' + escapedStr;\n if (!silent) {\n const token = state.push('text_special', '', 0);\n if (ch1 < 256 && ESCAPED[ch1] !== 0) {\n token.content = escapedStr;\n } else {\n token.content = origStr;\n }\n token.markup = origStr;\n token.info = 'escape';\n }\n state.pos = pos + 1;\n return true;\n}","map":{"version":3,"names":["isSpace","ESCAPED","i","push","split","forEach","ch","charCodeAt","escape","state","silent","pos","max","posMax","src","ch1","escapedStr","ch2","origStr","token","content","markup","info"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/markdown-it/lib/rules_inline/escape.mjs"],"sourcesContent":["// Process escaped chars and hardbreaks\n\nimport { isSpace } from '../common/utils.mjs'\n\nconst ESCAPED = []\n\nfor (let i = 0; i < 256; i++) { ESCAPED.push(0) }\n\n'\\\\!\"#$%&\\'()*+,./:;<=>?@[]^_`{|}~-'\n .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1 })\n\nexport default function escape (state, silent) {\n let pos = state.pos\n const max = state.posMax\n\n if (state.src.charCodeAt(pos) !== 0x5C/* \\ */) return false\n pos++\n\n // '\\' at the end of the inline block\n if (pos >= max) return false\n\n let ch1 = state.src.charCodeAt(pos)\n\n if (ch1 === 0x0A) {\n if (!silent) {\n state.push('hardbreak', 'br', 0)\n }\n\n pos++\n // skip leading whitespaces from next line\n while (pos < max) {\n ch1 = state.src.charCodeAt(pos)\n if (!isSpace(ch1)) break\n pos++\n }\n\n state.pos = pos\n return true\n }\n\n let escapedStr = state.src[pos]\n\n if (ch1 >= 0xD800 && ch1 <= 0xDBFF && pos + 1 < max) {\n const ch2 = state.src.charCodeAt(pos + 1)\n\n if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {\n escapedStr += state.src[pos + 1]\n pos++\n }\n }\n\n const origStr = '\\\\' + escapedStr\n\n if (!silent) {\n const token = state.push('text_special', '', 0)\n\n if (ch1 < 256 && ESCAPED[ch1] !== 0) {\n token.content = escapedStr\n } else {\n token.content = origStr\n }\n\n token.markup = origStr\n token.info = 'escape'\n }\n\n state.pos = pos + 1\n return true\n}\n"],"mappings":"AAAA;;AAEA,SAASA,OAAO,QAAQ,qBAAqB;AAE7C,MAAMC,OAAO,GAAG,EAAE;AAElB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,GAAG,EAAEA,CAAC,EAAE,EAAE;EAAED,OAAO,CAACE,IAAI,CAAC,CAAC,CAAC;AAAC;AAEhD,oCAAoC,CACjCC,KAAK,CAAC,EAAE,CAAC,CAACC,OAAO,CAAC,UAAUC,EAAE,EAAE;EAAEL,OAAO,CAACK,EAAE,CAACC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAAC,CAAC,CAAC;A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