@kirill.konshin/lint 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -7
- package/commands/spec-author.md +39 -0
- package/dist/configs/base.d.ts +4 -3
- package/dist/configs/base.js +61 -74
- package/dist/configs/imports.d.ts +3 -2
- package/dist/configs/imports.js +95 -146
- package/dist/configs/nx.d.ts +4 -3
- package/dist/configs/nx.js +31 -41
- package/dist/configs/prettier.d.ts +3 -2
- package/dist/configs/prettier.js +19 -16
- package/dist/configs/promise.d.ts +3 -2
- package/dist/configs/promise.js +16 -16
- package/dist/configs/react.d.ts +4 -3
- package/dist/configs/react.js +178 -217
- package/dist/configs/storybook.d.ts +4 -3
- package/dist/configs/storybook.js +22 -22
- package/dist/configs/tailwind.d.ts +4 -3
- package/dist/configs/tailwind.js +67 -91
- package/dist/configs/testing.d.ts +7 -6
- package/dist/configs/testing.js +112 -136
- package/dist/configs/turbo.d.ts +4 -3
- package/dist/configs/turbo.js +19 -27
- package/dist/configs/typescriptTypeAware.d.ts +4 -3
- package/dist/configs/typescriptTypeAware.js +99 -95
- package/dist/configs/unicorn.d.ts +3 -2
- package/dist/configs/unicorn.js +34 -41
- package/dist/exts.d.ts +2 -1
- package/dist/exts.js +10 -11
- package/dist/index.d.ts +44 -41
- package/dist/index.js +53 -84
- package/dist/lib.d.ts +21 -21
- package/dist/lib.js +261 -301
- package/dist/lintPrepare.d.ts +33 -28
- package/dist/lintPrepare.js +347 -376
- package/dist/lintStaged.d.ts +4 -3
- package/dist/lintStaged.js +25 -22
- package/dist/prettier.d.ts +4 -3
- package/dist/prettier.js +16 -17
- package/dist/restrictions.d.ts +24 -0
- package/dist/restrictions.js +20 -0
- package/dist/yarn.cjs +79 -98
- package/dist/yarn.d.cts +3 -2
- package/package.json +24 -8
- package/rules/agent.md +7 -4
- package/rules/openspec.md +1 -1
- package/skills/spec-steward/SKILL.md +4 -12
- package/skills/spec-steward/references/audit.md +18 -43
- package/skills/spec-steward/references/contract.md +7 -7
- package/skills/spec-steward/references/criteria.md +4 -4
- package/skills/spec-steward/references/model.md +1 -1
- package/skills/spec-steward/references/review-format.md +6 -6
- package/skills/spec-steward/references/wiring.md +4 -4
- package/skills/spec-steward/references/worker.md +67 -0
- package/skills/spec-steward/scripts/lib/align.mjs +7 -6
- package/skills/spec-steward/scripts/lib/checks.mjs +6 -1
- package/skills/spec-steward/scripts/lib/corpus.mjs +5 -8
- package/skills/spec-steward/scripts/lib/coverage.mjs +2 -3
- package/skills/spec-steward/scripts/lib/evidence.mjs +2 -148
- package/skills/spec-steward/scripts/lib/wire.mjs +6 -4
- package/skills/spec-steward/scripts/steward.mjs +30 -91
- package/skills/spec-steward/sweeps.json +49 -0
- package/skills/spec-tools/SKILL.md +46 -0
- package/skills/spec-tools/references/contract.md +111 -0
- package/skills/spec-tools/references/gitlab.md +122 -0
- package/skills/spec-verify/SKILL.md +153 -0
- package/spec-tools/dist/audit-DkZZulq6.mjs +130 -0
- package/spec-tools/dist/auditChanged-CNGjlake.mjs +1 -0
- package/spec-tools/dist/auditChanged-CZCvMgyZ.mjs +618 -0
- package/spec-tools/dist/auditReport-xgq4wK2i.mjs +458 -0
- package/spec-tools/dist/auditScope-CBuBtfPG.mjs +104 -0
- package/spec-tools/dist/changeGates-DdeQKfle.mjs +333 -0
- package/spec-tools/dist/changeGates-uy4Ti8rK.mjs +1 -0
- package/spec-tools/dist/ci-BUewHJS3.mjs +143 -0
- package/spec-tools/dist/ci-CFBzn8Of.mjs +1 -0
- package/spec-tools/dist/cli.mjs +93 -0
- package/spec-tools/dist/comment-szasMMg2.mjs +57 -0
- package/spec-tools/dist/files-Bppsb34B.mjs +1 -0
- package/spec-tools/dist/files-QlzY687_.mjs +38 -0
- package/spec-tools/dist/html-BMTkpbUN.mjs +1766 -0
- package/spec-tools/dist/jsonrepair-Dlm5dEen.mjs +742 -0
- package/spec-tools/dist/repo-CjIoUPYl.mjs +16 -0
- package/spec-tools/dist/repo-DUcnJw3c.mjs +1 -0
- package/spec-tools/dist/run-BElA9du3.mjs +67 -0
- package/spec-tools/dist/specDiff-8G56jMYn.mjs +123 -0
- package/spec-tools/dist/steward-DeieyOcj.mjs +34 -0
- package/spec-tools/dist/stewardAudit-BRMM0lrD.mjs +1 -0
- package/spec-tools/dist/stewardAudit-v0vOMfLN.mjs +271 -0
- package/spec-tools/dist/tier-Cn0P7juM.mjs +1 -0
- package/spec-tools/dist/tier-c3s_mA_I.mjs +65 -0
- package/spec-tools/dist/util-wnxhsnWO.mjs +49 -0
- package/spec-tools/dist/verdict-BFfN9PO8.mjs +58 -0
- package/spec-tools/dist/workers-BcIgckeq.mjs +417 -0
- package/spec-tools/dist/workflowEvidence-DyBj8EdG.mjs +1 -0
- package/spec-tools/dist/workflowEvidence-oui6ghPI.mjs +78 -0
- package/dist/configs/base.d.ts.map +0 -1
- package/dist/configs/imports.d.ts.map +0 -1
- package/dist/configs/nx.d.ts.map +0 -1
- package/dist/configs/prettier.d.ts.map +0 -1
- package/dist/configs/promise.d.ts.map +0 -1
- package/dist/configs/react.d.ts.map +0 -1
- package/dist/configs/storybook.d.ts.map +0 -1
- package/dist/configs/tailwind.d.ts.map +0 -1
- package/dist/configs/testing.d.ts.map +0 -1
- package/dist/configs/turbo.d.ts.map +0 -1
- package/dist/configs/typescriptTypeAware.d.ts.map +0 -1
- package/dist/configs/unicorn.d.ts.map +0 -1
- package/dist/exts.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib.d.ts.map +0 -1
- package/dist/lintPrepare.d.ts.map +0 -1
- package/dist/lintStaged.d.ts.map +0 -1
- package/dist/prettier.d.ts.map +0 -1
- package/dist/yarn.d.cts.map +0 -1
- package/skills/spec-steward/workflows/audit.js +0 -539
|
@@ -0,0 +1,1766 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
//#region ../../node_modules/github-markdown-css/github-markdown.css?raw
|
|
4
|
+
var github_markdown_default = ".markdown-body {\n --base-size-16: 1rem;\n --base-size-24: 1.5rem;\n --base-size-4: 0.25rem;\n --base-size-40: 2.5rem;\n --base-size-8: 0.5rem;\n --base-text-weight-medium: 500;\n --base-text-weight-normal: 400;\n --base-text-weight-semibold: 600;\n --fontStack-monospace: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;\n --fontStack-sansSerif: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\";\n --fgColor-accent: Highlight;\n}\n@media (prefers-color-scheme: dark) {\n .markdown-body, [data-theme=\"dark\"] {\n /*dark */\n color-scheme: dark;\n --fgColor-accent: #4493f8;\n --bgColor-attention-muted: #bb800926;\n --bgColor-default: #0d1117;\n --bgColor-muted: #151b23;\n --bgColor-neutral-muted: #656c7633;\n --borderColor-accent-emphasis: #1f6feb;\n --borderColor-attention-emphasis: #9e6a03;\n --borderColor-danger-emphasis: #da3633;\n --borderColor-default: #3d444d;\n --borderColor-done-emphasis: #8957e5;\n --borderColor-success-emphasis: #238636;\n --color-prettylights-syntax-brackethighlighter-angle: #9198a1;\n --color-prettylights-syntax-brackethighlighter-unmatched: #f85149;\n --color-prettylights-syntax-carriage-return-bg: #b62324;\n --color-prettylights-syntax-carriage-return-text: #f0f6fc;\n --color-prettylights-syntax-comment: #9198a1;\n --color-prettylights-syntax-constant: #79c0ff;\n --color-prettylights-syntax-constant-other-reference-link: #a5d6ff;\n --color-prettylights-syntax-entity: #d2a8ff;\n --color-prettylights-syntax-entity-tag: #7ee787;\n --color-prettylights-syntax-keyword: #ff7b72;\n --color-prettylights-syntax-markup-bold: #f0f6fc;\n --color-prettylights-syntax-markup-changed-bg: #5a1e02;\n --color-prettylights-syntax-markup-changed-text: #ffdfb6;\n --color-prettylights-syntax-markup-deleted-bg: #67060c;\n --color-prettylights-syntax-markup-deleted-text: #ffdcd7;\n --color-prettylights-syntax-markup-heading: #1f6feb;\n --color-prettylights-syntax-markup-ignored-bg: #1158c7;\n --color-prettylights-syntax-markup-ignored-text: #f0f6fc;\n --color-prettylights-syntax-markup-inserted-bg: #033a16;\n --color-prettylights-syntax-markup-inserted-text: #aff5b4;\n --color-prettylights-syntax-markup-italic: #f0f6fc;\n --color-prettylights-syntax-markup-list: #f2cc60;\n --color-prettylights-syntax-meta-diff-range: #d2a8ff;\n --color-prettylights-syntax-storage-modifier-import: #f0f6fc;\n --color-prettylights-syntax-string: #a5d6ff;\n --color-prettylights-syntax-string-regexp: #7ee787;\n --color-prettylights-syntax-sublimelinter-gutter-mark: #3d444d;\n --color-prettylights-syntax-variable: #ffa657;\n --fgColor-attention: #d29922;\n --fgColor-danger: #f85149;\n --fgColor-default: #f0f6fc;\n --fgColor-done: #ab7df8;\n --fgColor-muted: #9198a1;\n --fgColor-success: #3fb950;\n --borderColor-muted: #3d444db3;\n --color-prettylights-syntax-invalid-illegal-bg: var(--bgColor-danger-muted);\n --color-prettylights-syntax-invalid-illegal-text: var(--fgColor-danger);\n --focus-outlineColor: var(--borderColor-accent-emphasis);\n --borderColor-neutral-muted: var(--borderColor-muted);\n }\n}\n@media (prefers-color-scheme: light) {\n .markdown-body, [data-theme=\"light\"] {\n /*light */\n color-scheme: light;\n --fgColor-danger: #d1242f;\n --bgColor-attention-muted: #fff8c5;\n --bgColor-muted: #f6f8fa;\n --bgColor-neutral-muted: #818b981f;\n --borderColor-accent-emphasis: #0969da;\n --borderColor-attention-emphasis: #9a6700;\n --borderColor-danger-emphasis: #cf222e;\n --borderColor-default: #d1d9e0;\n --borderColor-done-emphasis: #8250df;\n --borderColor-success-emphasis: #1a7f37;\n --color-prettylights-syntax-brackethighlighter-angle: #59636e;\n --color-prettylights-syntax-brackethighlighter-unmatched: #82071e;\n --color-prettylights-syntax-carriage-return-bg: #cf222e;\n --color-prettylights-syntax-carriage-return-text: #f6f8fa;\n --color-prettylights-syntax-comment: #59636e;\n --color-prettylights-syntax-constant: #0550ae;\n --color-prettylights-syntax-constant-other-reference-link: #0a3069;\n --color-prettylights-syntax-entity: #6639ba;\n --color-prettylights-syntax-entity-tag: #0550ae;\n --color-prettylights-syntax-invalid-illegal-text: var(--fgColor-danger);\n --color-prettylights-syntax-keyword: #cf222e;\n --color-prettylights-syntax-markup-changed-bg: #ffd8b5;\n --color-prettylights-syntax-markup-changed-text: #953800;\n --color-prettylights-syntax-markup-deleted-bg: #ffebe9;\n --color-prettylights-syntax-markup-deleted-text: #82071e;\n --color-prettylights-syntax-markup-heading: #0550ae;\n --color-prettylights-syntax-markup-ignored-bg: #0550ae;\n --color-prettylights-syntax-markup-ignored-text: #d1d9e0;\n --color-prettylights-syntax-markup-inserted-bg: #dafbe1;\n --color-prettylights-syntax-markup-inserted-text: #116329;\n --color-prettylights-syntax-markup-list: #3b2300;\n --color-prettylights-syntax-meta-diff-range: #8250df;\n --color-prettylights-syntax-string: #0a3069;\n --color-prettylights-syntax-string-regexp: #116329;\n --color-prettylights-syntax-sublimelinter-gutter-mark: #818b98;\n --color-prettylights-syntax-variable: #953800;\n --fgColor-accent: #0969da;\n --fgColor-attention: #9a6700;\n --fgColor-done: #8250df;\n --fgColor-muted: #59636e;\n --fgColor-success: #1a7f37;\n --bgColor-default: #ffffff;\n --borderColor-muted: #d1d9e0b3;\n --color-prettylights-syntax-invalid-illegal-bg: var(--bgColor-danger-muted);\n --color-prettylights-syntax-markup-bold: #1f2328;\n --color-prettylights-syntax-markup-italic: #1f2328;\n --color-prettylights-syntax-storage-modifier-import: #1f2328;\n --fgColor-default: #1f2328;\n --focus-outlineColor: var(--borderColor-accent-emphasis);\n --borderColor-neutral-muted: var(--borderColor-muted);\n }\n}\n\n.markdown-body {\n /** CSS default easing. Use for hover state changes and micro-interactions. */\n /** Accelerating motion. Use for elements exiting the viewport (moving off-screen). */\n /** Smooth acceleration and deceleration. Use for elements moving or morphing within the viewport. */\n /** Decelerating motion. Use for elements entering the viewport or appearing on screen. */\n /** Constant motion with no acceleration. Use for continuous animations like progress bars or loaders. */\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n margin: 0;\n font-weight: var(--base-text-weight-normal, 400);\n color: var(--fgColor-default);\n background-color: var(--bgColor-default);\n font-family: var(--fontStack-sansSerif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\");\n font-size: 16px;\n line-height: 1.5;\n word-wrap: break-word;\n}\n\n.markdown-body a {\n text-decoration: underline;\n text-underline-offset: .2rem;\n}\n\n.markdown-body .octicon {\n display: inline-block;\n fill: currentColor;\n vertical-align: text-bottom;\n}\n\n.markdown-body h1:hover .anchor .octicon-link:before,\n.markdown-body h2:hover .anchor .octicon-link:before,\n.markdown-body h3:hover .anchor .octicon-link:before,\n.markdown-body h4:hover .anchor .octicon-link:before,\n.markdown-body h5:hover .anchor .octicon-link:before,\n.markdown-body h6:hover .anchor .octicon-link:before {\n width: 16px;\n height: 16px;\n content: ' ';\n display: inline-block;\n background-color: currentColor;\n -webkit-mask-image: url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>\");\n mask-image: url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>\");\n}\n\n.markdown-body details,\n.markdown-body figcaption,\n.markdown-body figure {\n display: block;\n}\n\n.markdown-body summary {\n display: list-item;\n}\n\n.markdown-body [hidden] {\n display: none !important;\n}\n\n.markdown-body a {\n background-color: rgba(0,0,0,0);\n color: var(--fgColor-accent);\n text-decoration: none;\n}\n\n.markdown-body abbr[title] {\n border-bottom: none;\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n.markdown-body b,\n.markdown-body strong {\n font-weight: var(--base-text-weight-semibold, 600);\n}\n\n.markdown-body dfn {\n font-style: italic;\n}\n\n.markdown-body h1 {\n margin: .67em 0;\n font-weight: var(--base-text-weight-semibold, 600);\n padding-bottom: .3em;\n font-size: 2em;\n border-bottom: 1px solid var(--borderColor-muted);\n}\n\n.markdown-body mark {\n background-color: var(--bgColor-attention-muted);\n color: var(--fgColor-default);\n}\n\n.markdown-body small {\n font-size: 90%;\n}\n\n.markdown-body sub,\n.markdown-body sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\n.markdown-body sub {\n bottom: -0.25em;\n}\n\n.markdown-body sup {\n top: -0.5em;\n}\n\n.markdown-body img {\n border-style: none;\n max-width: 100%;\n box-sizing: content-box;\n}\n\n.markdown-body code,\n.markdown-body kbd,\n.markdown-body pre,\n.markdown-body samp {\n font-family: monospace;\n font-size: 1em;\n}\n\n.markdown-body figure {\n margin: 1em var(--base-size-40);\n}\n\n.markdown-body hr {\n box-sizing: content-box;\n overflow: hidden;\n background: rgba(0,0,0,0);\n border-bottom: 1px solid var(--borderColor-muted);\n height: .25em;\n padding: 0;\n margin: var(--base-size-24) 0;\n background-color: var(--borderColor-default);\n border: 0;\n}\n\n.markdown-body input {\n font: inherit;\n margin: 0;\n overflow: visible;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n}\n\n.markdown-body [type=button],\n.markdown-body [type=reset],\n.markdown-body [type=submit] {\n -webkit-appearance: button;\n appearance: button;\n}\n\n.markdown-body [type=checkbox],\n.markdown-body [type=radio] {\n box-sizing: border-box;\n padding: 0;\n}\n\n.markdown-body [type=number]::-webkit-inner-spin-button,\n.markdown-body [type=number]::-webkit-outer-spin-button {\n height: auto;\n}\n\n.markdown-body [type=search]::-webkit-search-cancel-button,\n.markdown-body [type=search]::-webkit-search-decoration {\n -webkit-appearance: none;\n appearance: none;\n}\n\n.markdown-body ::-webkit-input-placeholder {\n color: inherit;\n opacity: .54;\n}\n\n.markdown-body ::-webkit-file-upload-button {\n -webkit-appearance: button;\n appearance: button;\n font: inherit;\n}\n\n.markdown-body a:hover {\n text-decoration: underline;\n}\n\n.markdown-body ::placeholder {\n color: var(--fgColor-muted);\n opacity: 1;\n}\n\n.markdown-body hr::before {\n display: table;\n content: \"\";\n}\n\n.markdown-body hr::after {\n display: table;\n clear: both;\n content: \"\";\n}\n\n.markdown-body table {\n border-spacing: 0;\n border-collapse: collapse;\n display: block;\n width: max-content;\n max-width: 100%;\n overflow: auto;\n font-variant: tabular-nums;\n}\n\n.markdown-body td,\n.markdown-body th {\n padding: 0;\n}\n\n.markdown-body details summary {\n cursor: pointer;\n}\n\n.markdown-body a:focus,\n.markdown-body [role=button]:focus,\n.markdown-body input[type=radio]:focus,\n.markdown-body input[type=checkbox]:focus {\n outline: 2px solid var(--focus-outlineColor);\n outline-offset: -2px;\n box-shadow: none;\n}\n\n.markdown-body a:focus:not(:focus-visible),\n.markdown-body [role=button]:focus:not(:focus-visible),\n.markdown-body input[type=radio]:focus:not(:focus-visible),\n.markdown-body input[type=checkbox]:focus:not(:focus-visible) {\n outline: solid 1px rgba(0,0,0,0);\n}\n\n.markdown-body a:focus-visible,\n.markdown-body [role=button]:focus-visible,\n.markdown-body input[type=radio]:focus-visible,\n.markdown-body input[type=checkbox]:focus-visible {\n outline: 2px solid var(--focus-outlineColor);\n outline-offset: -2px;\n box-shadow: none;\n}\n\n.markdown-body a:not([class]):focus,\n.markdown-body a:not([class]):focus-visible,\n.markdown-body input[type=radio]:focus,\n.markdown-body input[type=radio]:focus-visible,\n.markdown-body input[type=checkbox]:focus,\n.markdown-body input[type=checkbox]:focus-visible {\n outline-offset: 0;\n}\n\n.markdown-body kbd {\n display: inline-block;\n padding: var(--base-size-4);\n font: 11px var(--fontStack-monospace, ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace);\n line-height: 10px;\n color: var(--fgColor-default);\n vertical-align: middle;\n background-color: var(--bgColor-muted);\n border: solid 1px var(--borderColor-neutral-muted);\n border-bottom-color: var(--borderColor-neutral-muted);\n border-radius: 6px;\n box-shadow: inset 0 -1px 0 var(--borderColor-neutral-muted);\n}\n\n.markdown-body h1,\n.markdown-body h2,\n.markdown-body h3,\n.markdown-body h4,\n.markdown-body h5,\n.markdown-body h6 {\n margin-top: var(--base-size-24);\n margin-bottom: var(--base-size-16);\n font-weight: var(--base-text-weight-semibold, 600);\n line-height: 1.25;\n}\n\n.markdown-body h2 {\n font-weight: var(--base-text-weight-semibold, 600);\n padding-bottom: .3em;\n font-size: 1.5em;\n border-bottom: 1px solid var(--borderColor-muted);\n}\n\n.markdown-body h3 {\n font-weight: var(--base-text-weight-semibold, 600);\n font-size: 1.25em;\n}\n\n.markdown-body h4 {\n font-weight: var(--base-text-weight-semibold, 600);\n font-size: 1em;\n}\n\n.markdown-body h5 {\n font-weight: var(--base-text-weight-semibold, 600);\n font-size: .875em;\n}\n\n.markdown-body h6 {\n font-weight: var(--base-text-weight-semibold, 600);\n font-size: .85em;\n color: var(--fgColor-muted);\n}\n\n.markdown-body p {\n margin-top: 0;\n margin-bottom: 10px;\n}\n\n.markdown-body blockquote {\n margin: 0;\n padding: 0 1em;\n color: var(--fgColor-muted);\n border-left: .25em solid var(--borderColor-default);\n}\n\n.markdown-body ul,\n.markdown-body ol {\n margin-top: 0;\n margin-bottom: 0;\n padding-left: 2em;\n}\n\n.markdown-body ol ol,\n.markdown-body ul ol {\n list-style-type: lower-roman;\n}\n\n.markdown-body ul ul ol,\n.markdown-body ul ol ol,\n.markdown-body ol ul ol,\n.markdown-body ol ol ol {\n list-style-type: lower-alpha;\n}\n\n.markdown-body dd {\n margin-left: 0;\n}\n\n.markdown-body tt,\n.markdown-body code,\n.markdown-body samp {\n font-family: var(--fontStack-monospace, ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace);\n font-size: 12px;\n}\n\n.markdown-body pre {\n margin-top: 0;\n margin-bottom: 0;\n font-family: var(--fontStack-monospace, ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace);\n font-size: 12px;\n word-wrap: normal;\n}\n\n.markdown-body .octicon {\n display: inline-block;\n overflow: visible !important;\n vertical-align: text-bottom;\n fill: currentColor;\n}\n\n.markdown-body input::-webkit-outer-spin-button,\n.markdown-body input::-webkit-inner-spin-button {\n margin: 0;\n appearance: none;\n}\n\n.markdown-body .mr-2 {\n margin-right: var(--base-size-8, 8px) !important;\n}\n\n.markdown-body::before {\n display: table;\n content: \"\";\n}\n\n.markdown-body::after {\n display: table;\n clear: both;\n content: \"\";\n}\n\n.markdown-body>*:first-child {\n margin-top: 0 !important;\n}\n\n.markdown-body>*:last-child {\n margin-bottom: 0 !important;\n}\n\n.markdown-body a:not([href]) {\n color: inherit;\n text-decoration: none;\n}\n\n.markdown-body .absent {\n color: var(--fgColor-danger);\n}\n\n.markdown-body .anchor {\n float: left;\n padding-right: var(--base-size-4);\n margin-left: -20px;\n line-height: 1;\n}\n\n.markdown-body .anchor:focus {\n outline: none;\n}\n\n.markdown-body p,\n.markdown-body blockquote,\n.markdown-body ul,\n.markdown-body ol,\n.markdown-body dl,\n.markdown-body table,\n.markdown-body pre,\n.markdown-body details {\n margin-top: 0;\n margin-bottom: var(--base-size-16);\n}\n\n.markdown-body blockquote>:first-child {\n margin-top: 0;\n}\n\n.markdown-body blockquote>:last-child {\n margin-bottom: 0;\n}\n\n.markdown-body h1 .octicon-link,\n.markdown-body h2 .octicon-link,\n.markdown-body h3 .octicon-link,\n.markdown-body h4 .octicon-link,\n.markdown-body h5 .octicon-link,\n.markdown-body h6 .octicon-link {\n color: var(--fgColor-default);\n vertical-align: middle;\n visibility: hidden;\n}\n\n.markdown-body h1:hover .anchor,\n.markdown-body h2:hover .anchor,\n.markdown-body h3:hover .anchor,\n.markdown-body h4:hover .anchor,\n.markdown-body h5:hover .anchor,\n.markdown-body h6:hover .anchor {\n text-decoration: none;\n}\n\n.markdown-body h1:hover .anchor .octicon-link,\n.markdown-body h2:hover .anchor .octicon-link,\n.markdown-body h3:hover .anchor .octicon-link,\n.markdown-body h4:hover .anchor .octicon-link,\n.markdown-body h5:hover .anchor .octicon-link,\n.markdown-body h6:hover .anchor .octicon-link {\n visibility: visible;\n}\n\n.markdown-body h1 tt,\n.markdown-body h1 code,\n.markdown-body h2 tt,\n.markdown-body h2 code,\n.markdown-body h3 tt,\n.markdown-body h3 code,\n.markdown-body h4 tt,\n.markdown-body h4 code,\n.markdown-body h5 tt,\n.markdown-body h5 code,\n.markdown-body h6 tt,\n.markdown-body h6 code {\n padding: 0 .2em;\n font-size: inherit;\n}\n\n.markdown-body summary h1,\n.markdown-body summary h2,\n.markdown-body summary h3,\n.markdown-body summary h4,\n.markdown-body summary h5,\n.markdown-body summary h6 {\n display: inline-block;\n}\n\n.markdown-body summary h1 .anchor,\n.markdown-body summary h2 .anchor,\n.markdown-body summary h3 .anchor,\n.markdown-body summary h4 .anchor,\n.markdown-body summary h5 .anchor,\n.markdown-body summary h6 .anchor {\n margin-left: -40px;\n}\n\n.markdown-body summary h1,\n.markdown-body summary h2 {\n padding-bottom: 0;\n border-bottom: 0;\n}\n\n.markdown-body ul.no-list,\n.markdown-body ol.no-list {\n padding: 0;\n list-style-type: none;\n}\n\n.markdown-body ol[type=\"a s\"] {\n list-style-type: lower-alpha;\n}\n\n.markdown-body ol[type=\"A s\"] {\n list-style-type: upper-alpha;\n}\n\n.markdown-body ol[type=\"i s\"] {\n list-style-type: lower-roman;\n}\n\n.markdown-body ol[type=\"I s\"] {\n list-style-type: upper-roman;\n}\n\n.markdown-body ol[type=\"1\"] {\n list-style-type: decimal;\n}\n\n.markdown-body div>ol:not([type]) {\n list-style-type: decimal;\n}\n\n.markdown-body ul ul,\n.markdown-body ul ol,\n.markdown-body ol ol,\n.markdown-body ol ul {\n margin-top: 0;\n margin-bottom: 0;\n}\n\n.markdown-body li>p {\n margin-top: var(--base-size-16);\n}\n\n.markdown-body li+li {\n margin-top: .25em;\n}\n\n.markdown-body dl {\n padding: 0;\n}\n\n.markdown-body dl dt {\n padding: 0;\n margin-top: var(--base-size-16);\n font-size: 1em;\n font-style: italic;\n font-weight: var(--base-text-weight-semibold, 600);\n}\n\n.markdown-body dl dd {\n padding: 0 var(--base-size-16);\n margin-bottom: var(--base-size-16);\n}\n\n.markdown-body table th {\n font-weight: var(--base-text-weight-semibold, 600);\n}\n\n.markdown-body table th,\n.markdown-body table td {\n padding: 6px 13px;\n border: 1px solid var(--borderColor-default);\n}\n\n.markdown-body table td>:last-child {\n margin-bottom: 0;\n}\n\n.markdown-body table tr {\n background-color: var(--bgColor-default);\n border-top: 1px solid var(--borderColor-muted);\n}\n\n.markdown-body table tr:nth-child(2n) {\n background-color: var(--bgColor-muted);\n}\n\n.markdown-body table img {\n background-color: rgba(0,0,0,0);\n}\n\n.markdown-body img[align=right] {\n padding-left: 20px;\n}\n\n.markdown-body img[align=left] {\n padding-right: 20px;\n}\n\n.markdown-body .emoji {\n max-width: none;\n vertical-align: text-top;\n background-color: rgba(0,0,0,0);\n}\n\n.markdown-body span.frame {\n display: block;\n overflow: hidden;\n}\n\n.markdown-body span.frame>span {\n display: block;\n float: left;\n width: auto;\n padding: 7px;\n margin: 13px 0 0;\n overflow: hidden;\n border: 1px solid var(--borderColor-default);\n}\n\n.markdown-body span.frame span img {\n display: block;\n float: left;\n}\n\n.markdown-body span.frame span span {\n display: block;\n padding: 5px 0 0;\n clear: both;\n color: var(--fgColor-default);\n}\n\n.markdown-body span.align-center {\n display: block;\n overflow: hidden;\n clear: both;\n}\n\n.markdown-body span.align-center>span {\n display: block;\n margin: 13px auto 0;\n overflow: hidden;\n text-align: center;\n}\n\n.markdown-body span.align-center span img {\n margin: 0 auto;\n text-align: center;\n}\n\n.markdown-body span.align-right {\n display: block;\n overflow: hidden;\n clear: both;\n}\n\n.markdown-body span.align-right>span {\n display: block;\n margin: 13px 0 0;\n overflow: hidden;\n text-align: right;\n}\n\n.markdown-body span.align-right span img {\n margin: 0;\n text-align: right;\n}\n\n.markdown-body span.float-left {\n display: block;\n float: left;\n margin-right: 13px;\n overflow: hidden;\n}\n\n.markdown-body span.float-left span {\n margin: 13px 0 0;\n}\n\n.markdown-body span.float-right {\n display: block;\n float: right;\n margin-left: 13px;\n overflow: hidden;\n}\n\n.markdown-body span.float-right>span {\n display: block;\n margin: 13px auto 0;\n overflow: hidden;\n text-align: right;\n}\n\n.markdown-body code,\n.markdown-body tt {\n padding: .2em .4em;\n margin: 0;\n font-size: 85%;\n white-space: break-spaces;\n background-color: var(--bgColor-neutral-muted);\n border-radius: 6px;\n}\n\n.markdown-body code br,\n.markdown-body tt br {\n display: none;\n}\n\n.markdown-body del code {\n text-decoration: inherit;\n}\n\n.markdown-body samp {\n font-size: 85%;\n}\n\n.markdown-body pre code {\n font-size: 100%;\n}\n\n.markdown-body pre>code {\n padding: 0;\n margin: 0;\n word-break: normal;\n white-space: pre;\n background: rgba(0,0,0,0);\n border: 0;\n}\n\n.markdown-body .highlight {\n margin-bottom: var(--base-size-16);\n}\n\n.markdown-body .highlight pre {\n margin-bottom: 0;\n word-break: normal;\n}\n\n.markdown-body .highlight pre,\n.markdown-body pre {\n padding: var(--base-size-16);\n overflow: auto;\n font-size: 85%;\n line-height: 1.45;\n color: var(--fgColor-default);\n background-color: var(--bgColor-muted);\n border-radius: 6px;\n}\n\n.markdown-body pre code,\n.markdown-body pre tt {\n display: inline;\n padding: 0;\n margin: 0;\n overflow: visible;\n line-height: inherit;\n word-wrap: normal;\n background-color: rgba(0,0,0,0);\n border: 0;\n}\n\n.markdown-body .csv-data td,\n.markdown-body .csv-data th {\n padding: 5px;\n overflow: hidden;\n font-size: 12px;\n line-height: 1;\n text-align: left;\n white-space: nowrap;\n}\n\n.markdown-body .csv-data .blob-num {\n padding: 10px var(--base-size-8) 9px;\n text-align: right;\n background: var(--bgColor-default);\n border: 0;\n}\n\n.markdown-body .csv-data tr {\n border-top: 0;\n}\n\n.markdown-body .csv-data th {\n font-weight: var(--base-text-weight-semibold, 600);\n background: var(--bgColor-muted);\n border-top: 0;\n}\n\n.markdown-body [data-footnote-ref]::before {\n content: \"[\";\n}\n\n.markdown-body [data-footnote-ref]::after {\n content: \"]\";\n}\n\n.markdown-body .footnotes {\n font-size: 12px;\n color: var(--fgColor-muted);\n border-top: 1px solid var(--borderColor-default);\n}\n\n.markdown-body .footnotes ol {\n padding-left: var(--base-size-16);\n}\n\n.markdown-body .footnotes ol ul {\n display: inline-block;\n padding-left: var(--base-size-16);\n margin-top: var(--base-size-16);\n}\n\n.markdown-body .footnotes li {\n position: relative;\n}\n\n.markdown-body .footnotes li:target::before {\n position: absolute;\n top: calc(var(--base-size-8)*-1);\n right: calc(var(--base-size-8)*-1);\n bottom: calc(var(--base-size-8)*-1);\n left: calc(var(--base-size-24)*-1);\n pointer-events: none;\n content: \"\";\n border: 2px solid var(--borderColor-accent-emphasis);\n border-radius: 6px;\n}\n\n.markdown-body .footnotes li:target {\n color: var(--fgColor-default);\n}\n\n.markdown-body .footnotes .data-footnote-backref g-emoji {\n font-family: monospace;\n}\n\n.markdown-body .pl-c {\n color: var(--color-prettylights-syntax-comment);\n}\n\n.markdown-body .pl-c1,\n.markdown-body .pl-s .pl-v {\n color: var(--color-prettylights-syntax-constant);\n}\n\n.markdown-body .pl-e,\n.markdown-body .pl-en {\n color: var(--color-prettylights-syntax-entity);\n}\n\n.markdown-body .pl-smi,\n.markdown-body .pl-s .pl-s1 {\n color: var(--color-prettylights-syntax-storage-modifier-import);\n}\n\n.markdown-body .pl-ent {\n color: var(--color-prettylights-syntax-entity-tag);\n}\n\n.markdown-body .pl-k {\n color: var(--color-prettylights-syntax-keyword);\n}\n\n.markdown-body .pl-s,\n.markdown-body .pl-pds,\n.markdown-body .pl-s .pl-pse .pl-s1,\n.markdown-body .pl-sr,\n.markdown-body .pl-sr .pl-cce,\n.markdown-body .pl-sr .pl-sre,\n.markdown-body .pl-sr .pl-sra {\n color: var(--color-prettylights-syntax-string);\n}\n\n.markdown-body .pl-v,\n.markdown-body .pl-smw {\n color: var(--color-prettylights-syntax-variable);\n}\n\n.markdown-body .pl-bu {\n color: var(--color-prettylights-syntax-brackethighlighter-unmatched);\n}\n\n.markdown-body .pl-ii {\n color: var(--color-prettylights-syntax-invalid-illegal-text);\n background-color: var(--color-prettylights-syntax-invalid-illegal-bg);\n}\n\n.markdown-body .pl-c2 {\n color: var(--color-prettylights-syntax-carriage-return-text);\n background-color: var(--color-prettylights-syntax-carriage-return-bg);\n}\n\n.markdown-body .pl-sr .pl-cce {\n font-weight: bold;\n color: var(--color-prettylights-syntax-string-regexp);\n}\n\n.markdown-body .pl-ml {\n color: var(--color-prettylights-syntax-markup-list);\n}\n\n.markdown-body .pl-mh,\n.markdown-body .pl-mh .pl-en,\n.markdown-body .pl-ms {\n font-weight: bold;\n color: var(--color-prettylights-syntax-markup-heading);\n}\n\n.markdown-body .pl-mi {\n font-style: italic;\n color: var(--color-prettylights-syntax-markup-italic);\n}\n\n.markdown-body .pl-mb {\n font-weight: bold;\n color: var(--color-prettylights-syntax-markup-bold);\n}\n\n.markdown-body .pl-md {\n color: var(--color-prettylights-syntax-markup-deleted-text);\n background-color: var(--color-prettylights-syntax-markup-deleted-bg);\n}\n\n.markdown-body .pl-mi1 {\n color: var(--color-prettylights-syntax-markup-inserted-text);\n background-color: var(--color-prettylights-syntax-markup-inserted-bg);\n}\n\n.markdown-body .pl-mc {\n color: var(--color-prettylights-syntax-markup-changed-text);\n background-color: var(--color-prettylights-syntax-markup-changed-bg);\n}\n\n.markdown-body .pl-mi2 {\n color: var(--color-prettylights-syntax-markup-ignored-text);\n background-color: var(--color-prettylights-syntax-markup-ignored-bg);\n}\n\n.markdown-body .pl-mdr {\n font-weight: bold;\n color: var(--color-prettylights-syntax-meta-diff-range);\n}\n\n.markdown-body .pl-ba {\n color: var(--color-prettylights-syntax-brackethighlighter-angle);\n}\n\n.markdown-body .pl-sg {\n color: var(--color-prettylights-syntax-sublimelinter-gutter-mark);\n}\n\n.markdown-body .pl-corl {\n text-decoration: underline;\n color: var(--color-prettylights-syntax-constant-other-reference-link);\n}\n\n.markdown-body [role=button]:focus:not(:focus-visible),\n.markdown-body [role=tabpanel][tabindex=\"0\"]:focus:not(:focus-visible),\n.markdown-body button:focus:not(:focus-visible),\n.markdown-body summary:focus:not(:focus-visible),\n.markdown-body a:focus:not(:focus-visible) {\n outline: none;\n box-shadow: none;\n}\n\n.markdown-body [tabindex=\"0\"]:focus:not(:focus-visible),\n.markdown-body details-dialog:focus:not(:focus-visible) {\n outline: none;\n}\n\n.markdown-body g-emoji {\n display: inline-block;\n min-width: 1ch;\n font-family: \"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\";\n font-size: 1em;\n font-style: normal !important;\n font-weight: var(--base-text-weight-normal, 400);\n line-height: 1;\n vertical-align: -0.075em;\n}\n\n.markdown-body g-emoji img {\n width: 1em;\n height: 1em;\n}\n\n.markdown-body a:has(>p,>div,>pre,>blockquote) {\n display: block;\n}\n\n.markdown-body a:has(>p,>div,>pre,>blockquote):not(:has(.snippet-clipboard-content,>pre)) {\n width: fit-content;\n}\n\n.markdown-body a:has(>p,>div,>pre,>blockquote):has(.snippet-clipboard-content,>pre):focus-visible {\n outline: 2px solid var(--focus-outlineColor);\n outline-offset: 2px;\n}\n\n.markdown-body .task-list-item {\n list-style-type: none;\n}\n\n.markdown-body .task-list-item label {\n font-weight: var(--base-text-weight-normal, 400);\n}\n\n.markdown-body .task-list-item.enabled label {\n cursor: pointer;\n}\n\n.markdown-body .task-list-item+.task-list-item {\n margin-top: var(--base-size-4);\n}\n\n.markdown-body .task-list-item .handle {\n display: none;\n}\n\n.markdown-body .task-list-item-checkbox {\n margin: 0 .2em .25em -1.4em;\n vertical-align: middle;\n}\n\n.markdown-body ul:dir(rtl) .task-list-item-checkbox {\n margin: 0 -1.6em .25em .2em;\n}\n\n.markdown-body ol:dir(rtl) .task-list-item-checkbox {\n margin: 0 -1.6em .25em .2em;\n}\n\n.markdown-body .contains-task-list:hover .task-list-item-convert-container,\n.markdown-body .contains-task-list:focus-within .task-list-item-convert-container {\n display: block;\n width: auto;\n height: 24px;\n overflow: visible;\n clip-path: none;\n}\n\n.markdown-body ::-webkit-calendar-picker-indicator {\n filter: invert(50%);\n}\n\n.markdown-body .markdown-alert {\n padding: var(--base-size-8) var(--base-size-16);\n margin-bottom: var(--base-size-16);\n color: inherit;\n border-left: .25em solid var(--borderColor-default);\n}\n\n.markdown-body .markdown-alert>:first-child {\n margin-top: 0;\n}\n\n.markdown-body .markdown-alert>:last-child {\n margin-bottom: 0;\n}\n\n.markdown-body .markdown-alert .markdown-alert-title {\n display: flex;\n font-weight: var(--base-text-weight-medium, 500);\n align-items: center;\n line-height: 1;\n}\n\n.markdown-body .markdown-alert.markdown-alert-note {\n border-left-color: var(--borderColor-accent-emphasis);\n}\n\n.markdown-body .markdown-alert.markdown-alert-note .markdown-alert-title {\n color: var(--fgColor-accent);\n}\n\n.markdown-body .markdown-alert.markdown-alert-important {\n border-left-color: var(--borderColor-done-emphasis);\n}\n\n.markdown-body .markdown-alert.markdown-alert-important .markdown-alert-title {\n color: var(--fgColor-done);\n}\n\n.markdown-body .markdown-alert.markdown-alert-warning {\n border-left-color: var(--borderColor-attention-emphasis);\n}\n\n.markdown-body .markdown-alert.markdown-alert-warning .markdown-alert-title {\n color: var(--fgColor-attention);\n}\n\n.markdown-body .markdown-alert.markdown-alert-tip {\n border-left-color: var(--borderColor-success-emphasis);\n}\n\n.markdown-body .markdown-alert.markdown-alert-tip .markdown-alert-title {\n color: var(--fgColor-success);\n}\n\n.markdown-body .markdown-alert.markdown-alert-caution {\n border-left-color: var(--borderColor-danger-emphasis);\n}\n\n.markdown-body .markdown-alert.markdown-alert-caution .markdown-alert-title {\n color: var(--fgColor-danger);\n}\n\n.markdown-body>*:first-child>.heading-element:first-child {\n margin-top: 0 !important;\n}\n\n.markdown-body .highlight pre:has(+.zeroclipboard-container) {\n min-height: 52px;\n}\n\n";
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region ../../node_modules/marked/lib/marked.esm.js
|
|
7
|
+
/**
|
|
8
|
+
* marked v18.1.0 - a markdown parser
|
|
9
|
+
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
10
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
11
|
+
* https://github.com/markedjs/marked
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* DO NOT EDIT THIS FILE
|
|
15
|
+
* The code in this file is generated from files in ./src/
|
|
16
|
+
*/
|
|
17
|
+
function I() {
|
|
18
|
+
return {
|
|
19
|
+
async: !1,
|
|
20
|
+
breaks: !1,
|
|
21
|
+
extensions: null,
|
|
22
|
+
gfm: !0,
|
|
23
|
+
hooks: null,
|
|
24
|
+
pedantic: !1,
|
|
25
|
+
renderer: null,
|
|
26
|
+
silent: !1,
|
|
27
|
+
tokenizer: null,
|
|
28
|
+
walkTokens: null
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
var P = I();
|
|
32
|
+
function W(l) {
|
|
33
|
+
P = l;
|
|
34
|
+
}
|
|
35
|
+
var A = { exec: () => null };
|
|
36
|
+
function C(l) {
|
|
37
|
+
let e = [];
|
|
38
|
+
return (t) => {
|
|
39
|
+
let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
|
|
40
|
+
return s || (s = l(n), e[n] = s), s;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function h(l, e = "") {
|
|
44
|
+
let t = typeof l == "string" ? l : l.source, n = {
|
|
45
|
+
replace: (s, r) => {
|
|
46
|
+
let o = typeof r == "string" ? r : r.source;
|
|
47
|
+
return o = o.replace(x.caret, "$1"), t = t.replace(s, o), n;
|
|
48
|
+
},
|
|
49
|
+
getRegex: () => new RegExp(t, e)
|
|
50
|
+
};
|
|
51
|
+
return n;
|
|
52
|
+
}
|
|
53
|
+
var _e = ((l = "") => {
|
|
54
|
+
try {
|
|
55
|
+
return !!new RegExp("(?<=1)(?<!1)" + l);
|
|
56
|
+
} catch {
|
|
57
|
+
return !1;
|
|
58
|
+
}
|
|
59
|
+
})();
|
|
60
|
+
var x = {
|
|
61
|
+
codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm,
|
|
62
|
+
outputLinkReplace: /\\([\[\]])/g,
|
|
63
|
+
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
64
|
+
beginningSpace: /^\s+/,
|
|
65
|
+
endingHash: /#$/,
|
|
66
|
+
startingSpaceChar: /^ /,
|
|
67
|
+
endingSpaceChar: / $/,
|
|
68
|
+
endingSpaceTabChar: /[ \t]$/,
|
|
69
|
+
nonSpaceChar: /[^ ]/,
|
|
70
|
+
newLineCharGlobal: /\n/g,
|
|
71
|
+
tabCharGlobal: /\t/g,
|
|
72
|
+
leadingSpaceTab: /^[ \t]+/,
|
|
73
|
+
multipleSpaceGlobal: /\s+/g,
|
|
74
|
+
blankLine: /^[ \t]*$/,
|
|
75
|
+
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
76
|
+
blockquoteStart: /^ {0,3}>/,
|
|
77
|
+
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
78
|
+
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
79
|
+
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
80
|
+
listIsTask: /^\[[ xX]\] +\S/,
|
|
81
|
+
listReplaceTask: /^\[[ xX]\] +/,
|
|
82
|
+
listTaskCheckbox: /\[[ xX]\]/,
|
|
83
|
+
anyLine: /\n.*\n/,
|
|
84
|
+
hrefBrackets: /^<(.*)>$/,
|
|
85
|
+
tableDelimiter: /[:|]/,
|
|
86
|
+
tableAlignChars: /^\||\| *$/g,
|
|
87
|
+
tableRowBlankLine: /\n[ \t]*$/,
|
|
88
|
+
tableAlignRight: /^ *-+: *$/,
|
|
89
|
+
tableAlignCenter: /^ *:-+: *$/,
|
|
90
|
+
tableAlignLeft: /^ *:-+ *$/,
|
|
91
|
+
startATag: /^<a /i,
|
|
92
|
+
endATag: /^<\/a>/i,
|
|
93
|
+
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
94
|
+
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
95
|
+
startAngleBracket: /^</,
|
|
96
|
+
endAngleBracket: />$/,
|
|
97
|
+
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
98
|
+
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
99
|
+
numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,
|
|
100
|
+
escapeTest: /[&<>"']/,
|
|
101
|
+
escapeReplace: /[&<>"']/g,
|
|
102
|
+
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
103
|
+
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
104
|
+
caret: /(^|[^\[])\^/g,
|
|
105
|
+
percentDecode: /%25/g,
|
|
106
|
+
findPipe: /\|/g,
|
|
107
|
+
splitPipe: / \|/,
|
|
108
|
+
slashPipe: /\\\|/g,
|
|
109
|
+
carriageReturn: /\r\n|\r/g,
|
|
110
|
+
spaceLine: /^ +$/gm,
|
|
111
|
+
notSpaceStart: /^\S*/,
|
|
112
|
+
endingNewline: /\n$/,
|
|
113
|
+
listItemRegex: (l) => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
114
|
+
nextBulletRegex: C((l) => new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
|
|
115
|
+
hrRegex: C((l) => new RegExp(`^ {0,${l}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),
|
|
116
|
+
fencesBeginRegex: C((l) => new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)),
|
|
117
|
+
headingBeginRegex: C((l) => new RegExp(`^ {0,${l}}#`)),
|
|
118
|
+
htmlBeginRegex: C((l) => new RegExp(`^ {0,${l}}(?:</?(?:${N})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")),
|
|
119
|
+
blockquoteBeginRegex: C((l) => new RegExp(`^ {0,${l}}>`))
|
|
120
|
+
};
|
|
121
|
+
var $e = /^(?:[ \t]*(?:\n|$))+/;
|
|
122
|
+
var Le = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
123
|
+
var ze = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
124
|
+
var G = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
125
|
+
var Ae = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
126
|
+
var J = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
|
|
127
|
+
var he = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
128
|
+
var de = h(he).replace(/bull/g, J).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
129
|
+
var Ee = h(he).replace(/bull/g, J).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
130
|
+
var V = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
|
|
131
|
+
var Me = /^[^\n]+/;
|
|
132
|
+
var Y = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
|
|
133
|
+
var Ie = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Y).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
134
|
+
var Ce = h(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, J).getRegex();
|
|
135
|
+
var N = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
136
|
+
var ee = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
137
|
+
var Be = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ee).replace("tag", N).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
138
|
+
var ke = (l) => h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", l).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
|
|
139
|
+
var De = ke(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
|
|
140
|
+
var qe = ke(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
|
|
141
|
+
var te = {
|
|
142
|
+
blockquote: h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", qe).getRegex(),
|
|
143
|
+
code: Le,
|
|
144
|
+
def: Ie,
|
|
145
|
+
fences: ze,
|
|
146
|
+
heading: Ae,
|
|
147
|
+
hr: G,
|
|
148
|
+
html: Be,
|
|
149
|
+
lheading: de,
|
|
150
|
+
list: Ce,
|
|
151
|
+
newline: $e,
|
|
152
|
+
paragraph: De,
|
|
153
|
+
table: A,
|
|
154
|
+
text: Me
|
|
155
|
+
};
|
|
156
|
+
var ue = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
|
|
157
|
+
var Ze = {
|
|
158
|
+
...te,
|
|
159
|
+
lheading: Ee,
|
|
160
|
+
table: ue,
|
|
161
|
+
paragraph: h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ue).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex()
|
|
162
|
+
};
|
|
163
|
+
var He = {
|
|
164
|
+
...te,
|
|
165
|
+
html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ee).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
166
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
167
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
168
|
+
fences: A,
|
|
169
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
170
|
+
paragraph: h(V).replace("hr", G).replace("heading", ` *#{1,6} *[^
|
|
171
|
+
]`).replace("lheading", de).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
172
|
+
};
|
|
173
|
+
var Ge = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
174
|
+
var Ne = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
175
|
+
var ge = /^( {2,}|\\)\n(?!\s*$)[ \t]*/;
|
|
176
|
+
var Qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
177
|
+
var $ = /[\p{P}\p{S}]/u;
|
|
178
|
+
var B = /[\s\p{P}\p{S}]/u;
|
|
179
|
+
var Q = /[^\s\p{P}\p{S}]/u;
|
|
180
|
+
var je = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, B).getRegex();
|
|
181
|
+
var Fe = /[\p{Pi}\p{Ps}"']/u;
|
|
182
|
+
var fe = /(?!~)[\p{P}\p{S}]/u;
|
|
183
|
+
var Ue = /(?!~)[\s\p{P}\p{S}]/u;
|
|
184
|
+
var Ke = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
185
|
+
var We = h(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", _e ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
|
|
186
|
+
var me = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
|
|
187
|
+
var Xe = h(me, "u").replace(/punct/g, $).getRegex();
|
|
188
|
+
var Je = h(me, "u").replace(/punct/g, fe).getRegex();
|
|
189
|
+
var Ye = h(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, Fe).replace(/punct/g, $).getRegex();
|
|
190
|
+
var xe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
191
|
+
var et = h(xe, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
192
|
+
var tt = h(xe, "gu").replace(/notPunctSpace/g, Ke).replace(/punctSpace/g, Ue).replace(/punct/g, fe).getRegex();
|
|
193
|
+
var rt = h("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
194
|
+
var st = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
195
|
+
var ot = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
196
|
+
var at = h(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, $).getRegex();
|
|
197
|
+
var ut = h("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
198
|
+
var pt = h(/\\(punct)/, "gu").replace(/punct/g, $).getRegex();
|
|
199
|
+
var ct = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
|
|
200
|
+
var ht = h(ee).replace("(?:-->|$)", "-->").getRegex();
|
|
201
|
+
var dt = h("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ht).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
202
|
+
var be = /\[(?:\\[\s\S]|[^\[\]\\])*\]/;
|
|
203
|
+
var U = h(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", be).getRegex();
|
|
204
|
+
var kt = h(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label", U).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
205
|
+
var gt = h(/^!?\[(label)\]\[(ref)\]/).replace("label", U).replace("ref", Y).getRegex();
|
|
206
|
+
var ft = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Y).getRegex();
|
|
207
|
+
var pe = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/;
|
|
208
|
+
var mt = h(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", be).getRegex();
|
|
209
|
+
var xt = h("reflink|nolink(?!\\()", "g").replace("reflink", h(/^!?\[(label)\]\[(ref)\]/).replace("label", mt).replace("ref", pe).getRegex()).replace("nolink", h(/^!?\[(ref)\](?:\[\])?/).replace("ref", pe).getRegex()).getRegex();
|
|
210
|
+
var ce = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
211
|
+
var Rt = h(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex();
|
|
212
|
+
var ne = {
|
|
213
|
+
_backpedal: A,
|
|
214
|
+
anyPunctuation: pt,
|
|
215
|
+
autolink: ct,
|
|
216
|
+
blockSkip: We,
|
|
217
|
+
br: ge,
|
|
218
|
+
code: Ne,
|
|
219
|
+
del: A,
|
|
220
|
+
delLDelim: A,
|
|
221
|
+
delRDelim: A,
|
|
222
|
+
emStrongLDelim: Xe,
|
|
223
|
+
emStrongRDelimAst: et,
|
|
224
|
+
emStrongRDelimUnd: st,
|
|
225
|
+
escape: Ge,
|
|
226
|
+
link: kt,
|
|
227
|
+
nolink: ft,
|
|
228
|
+
punctuation: je,
|
|
229
|
+
reflink: gt,
|
|
230
|
+
reflinkSearch: xt,
|
|
231
|
+
tag: dt,
|
|
232
|
+
text: Qe,
|
|
233
|
+
url: A
|
|
234
|
+
};
|
|
235
|
+
var Tt = {
|
|
236
|
+
...ne,
|
|
237
|
+
emStrongLDelim: Ye,
|
|
238
|
+
emStrongRDelimAst: rt,
|
|
239
|
+
emStrongRDelimUnd: ot,
|
|
240
|
+
link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", U).getRegex(),
|
|
241
|
+
reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", U).getRegex()
|
|
242
|
+
};
|
|
243
|
+
var X = {
|
|
244
|
+
...ne,
|
|
245
|
+
emStrongRDelimAst: tt,
|
|
246
|
+
emStrongLDelim: Je,
|
|
247
|
+
delLDelim: at,
|
|
248
|
+
delRDelim: ut,
|
|
249
|
+
url: h(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Rt).replace("protocol", ce).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),
|
|
250
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
251
|
+
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
252
|
+
text: h(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", ce).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex()
|
|
253
|
+
};
|
|
254
|
+
var Ot = {
|
|
255
|
+
...X,
|
|
256
|
+
br: h(ge).replace("{2,}", "*").getRegex(),
|
|
257
|
+
text: h(X.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
258
|
+
};
|
|
259
|
+
var j = {
|
|
260
|
+
normal: te,
|
|
261
|
+
gfm: Ze,
|
|
262
|
+
pedantic: He
|
|
263
|
+
};
|
|
264
|
+
var D = {
|
|
265
|
+
normal: ne,
|
|
266
|
+
gfm: X,
|
|
267
|
+
breaks: Ot,
|
|
268
|
+
pedantic: Tt
|
|
269
|
+
};
|
|
270
|
+
var wt = {
|
|
271
|
+
"&": "&",
|
|
272
|
+
"<": "<",
|
|
273
|
+
">": ">",
|
|
274
|
+
"\"": """,
|
|
275
|
+
"'": "'"
|
|
276
|
+
};
|
|
277
|
+
var Re = (l) => wt[l];
|
|
278
|
+
function O(l, e) {
|
|
279
|
+
if (e) {
|
|
280
|
+
if (x.escapeTest.test(l)) return l.replace(x.escapeReplace, Re);
|
|
281
|
+
} else if (x.escapeTestNoEncode.test(l)) return l.replace(x.escapeReplaceNoEncode, Re);
|
|
282
|
+
return l;
|
|
283
|
+
}
|
|
284
|
+
function Te(l) {
|
|
285
|
+
return l.replace(x.numericCharacterReference, (e, t, n) => {
|
|
286
|
+
let s = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
|
|
287
|
+
return s === 0 || s > 1114111 || s >= 55296 && s <= 57343 ? "�" : String.fromCodePoint(s);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function re(l) {
|
|
291
|
+
try {
|
|
292
|
+
l = encodeURI(l).replace(x.percentDecode, "%");
|
|
293
|
+
} catch {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
return l;
|
|
297
|
+
}
|
|
298
|
+
function se(l, e) {
|
|
299
|
+
let n = l.replace(x.findPipe, (r, o, i) => {
|
|
300
|
+
let u = !1, a = o;
|
|
301
|
+
for (; --a >= 0 && i[a] === "\\";) u = !u;
|
|
302
|
+
return u ? "|" : " |";
|
|
303
|
+
}).split(x.splitPipe), s = 0;
|
|
304
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
305
|
+
else for (; n.length < e;) n.push("");
|
|
306
|
+
for (; s < n.length; s++) n[s] = n[s].trim().replace(x.slashPipe, "|");
|
|
307
|
+
return n;
|
|
308
|
+
}
|
|
309
|
+
function L(l, e, t) {
|
|
310
|
+
let n = l.length;
|
|
311
|
+
if (n === 0) return "";
|
|
312
|
+
let s = 0;
|
|
313
|
+
for (; s < n;) {
|
|
314
|
+
let r = l.charAt(n - s - 1);
|
|
315
|
+
if (r === e && !t) s++;
|
|
316
|
+
else if (r !== e && t) s++;
|
|
317
|
+
else break;
|
|
318
|
+
}
|
|
319
|
+
return l.slice(0, n - s);
|
|
320
|
+
}
|
|
321
|
+
function ie(l) {
|
|
322
|
+
let e = l.split(`
|
|
323
|
+
`), t = e.length - 1;
|
|
324
|
+
for (; t >= 0 && x.blankLine.test(e[t]);) t--;
|
|
325
|
+
return e.length - t <= 2 ? l : e.slice(0, t + 1).join(`
|
|
326
|
+
`);
|
|
327
|
+
}
|
|
328
|
+
function q(l) {
|
|
329
|
+
return l.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
330
|
+
}
|
|
331
|
+
function oe(l, e) {
|
|
332
|
+
if (l.indexOf(e[0]) === -1 && l.indexOf(e[1]) === -1) return -1;
|
|
333
|
+
let t = 0;
|
|
334
|
+
for (let n = 0; n < l.length; n++) if (l[n] === "\\") n++;
|
|
335
|
+
else if (l[n] === e[0]) t++;
|
|
336
|
+
else if (l[n] === e[1] && (t--, t < 0)) return n;
|
|
337
|
+
return t > 0 ? -2 : -1;
|
|
338
|
+
}
|
|
339
|
+
function ae(l, e = 0) {
|
|
340
|
+
let t = e, n = "";
|
|
341
|
+
for (let s of l) if (s === " ") {
|
|
342
|
+
let r = 4 - t % 4;
|
|
343
|
+
n += " ".repeat(r), t += r;
|
|
344
|
+
} else n += s, t++;
|
|
345
|
+
return n;
|
|
346
|
+
}
|
|
347
|
+
function Oe(l, e, t, n, s) {
|
|
348
|
+
let r = e.href, o = e.title || null, i = l[1].replace(s.other.outputLinkReplace, "$1"), u = l[0].charAt(0) === "!";
|
|
349
|
+
n.state.inLink = !0;
|
|
350
|
+
let a = n.state.linkEmitted, p = n.state.inRawBlock;
|
|
351
|
+
n.state.linkEmitted = !1;
|
|
352
|
+
let c = n.inlineTokens(i), d = n.state.linkEmitted;
|
|
353
|
+
if (n.state.linkEmitted = a, n.state.inLink = !1, !u) {
|
|
354
|
+
if (d) {
|
|
355
|
+
n.state.inRawBlock = p;
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
n.state.linkEmitted = !0;
|
|
359
|
+
}
|
|
360
|
+
return {
|
|
361
|
+
type: u ? "image" : "link",
|
|
362
|
+
raw: t,
|
|
363
|
+
href: r,
|
|
364
|
+
title: o,
|
|
365
|
+
text: i,
|
|
366
|
+
tokens: c
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function Pt(l, e, t) {
|
|
370
|
+
let n = l.match(t.other.indentCodeCompensation);
|
|
371
|
+
if (n === null) return e;
|
|
372
|
+
let s = n[1];
|
|
373
|
+
return e.split(`
|
|
374
|
+
`).map((r) => {
|
|
375
|
+
let o = r.match(t.other.beginningSpace);
|
|
376
|
+
if (o === null) return r;
|
|
377
|
+
let [i] = o;
|
|
378
|
+
return r.slice(Math.min(i.length, s.length));
|
|
379
|
+
}).join(`
|
|
380
|
+
`);
|
|
381
|
+
}
|
|
382
|
+
function we(l, e, t, n) {
|
|
383
|
+
if (!e.includes("<")) return !1;
|
|
384
|
+
for (let s = 0; s < e.length; s++) {
|
|
385
|
+
if (e[s] === "\\") {
|
|
386
|
+
s++;
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
if (e[s] === "`") {
|
|
390
|
+
let i = n.inline.code.exec(e.slice(s));
|
|
391
|
+
if (i) {
|
|
392
|
+
s += i[0].length - 1;
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (e[s] !== "<") continue;
|
|
397
|
+
let r = l.slice(t + s), o = n.inline.tag.exec(r) || n.inline.autolink.exec(r);
|
|
398
|
+
if (o) {
|
|
399
|
+
if (o[0].length > e.length - s) return !0;
|
|
400
|
+
s += o[0].length - 1;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return !1;
|
|
404
|
+
}
|
|
405
|
+
var y = class {
|
|
406
|
+
options;
|
|
407
|
+
rules;
|
|
408
|
+
lexer;
|
|
409
|
+
constructor(e) {
|
|
410
|
+
this.options = e || P;
|
|
411
|
+
}
|
|
412
|
+
space(e) {
|
|
413
|
+
let t = this.rules.block.newline.exec(e);
|
|
414
|
+
if (t && t[0].length > 0) return {
|
|
415
|
+
type: "space",
|
|
416
|
+
raw: t[0]
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
code(e) {
|
|
420
|
+
let t = this.rules.block.code.exec(e);
|
|
421
|
+
if (t) {
|
|
422
|
+
let n = this.options.pedantic ? t[0] : ie(t[0]);
|
|
423
|
+
return {
|
|
424
|
+
type: "code",
|
|
425
|
+
raw: n,
|
|
426
|
+
codeBlockStyle: "indented",
|
|
427
|
+
text: n.replace(this.rules.other.codeRemoveIndent, "")
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
fences(e) {
|
|
432
|
+
let t = this.rules.block.fences.exec(e);
|
|
433
|
+
if (t) {
|
|
434
|
+
let n = t[0], s = Pt(n, t[3] || "", this.rules);
|
|
435
|
+
return {
|
|
436
|
+
type: "code",
|
|
437
|
+
raw: n,
|
|
438
|
+
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
439
|
+
text: s
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
heading(e) {
|
|
444
|
+
let t = this.rules.block.heading.exec(e);
|
|
445
|
+
if (t) {
|
|
446
|
+
let n = t[2].trim();
|
|
447
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
448
|
+
let s = L(n, "#");
|
|
449
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceTabChar.test(s)) && (n = s.trim());
|
|
450
|
+
}
|
|
451
|
+
return {
|
|
452
|
+
type: "heading",
|
|
453
|
+
raw: L(t[0], `
|
|
454
|
+
`),
|
|
455
|
+
depth: t[1].length,
|
|
456
|
+
text: n,
|
|
457
|
+
tokens: this.lexer.inline(n)
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
hr(e) {
|
|
462
|
+
let t = this.rules.block.hr.exec(e);
|
|
463
|
+
if (t) return {
|
|
464
|
+
type: "hr",
|
|
465
|
+
raw: L(t[0], `
|
|
466
|
+
`)
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
blockquote(e) {
|
|
470
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
471
|
+
if (t) {
|
|
472
|
+
let n = L(t[0], `
|
|
473
|
+
`).split(`
|
|
474
|
+
`), s = "", r = "", o = [];
|
|
475
|
+
for (; n.length > 0;) {
|
|
476
|
+
let i = !1, u = [], a = 0;
|
|
477
|
+
for (; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) u.push(n[a]), i = !0;
|
|
478
|
+
else if (!i) u.push(n[a]);
|
|
479
|
+
else break;
|
|
480
|
+
n = n.slice(a);
|
|
481
|
+
let p = u.join(`
|
|
482
|
+
`), c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
483
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
484
|
+
s = s ? `${s}
|
|
485
|
+
${p}` : p, r = r ? `${r}
|
|
486
|
+
${c}` : c;
|
|
487
|
+
let d = this.lexer.state.top;
|
|
488
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(c, o, !0), this.lexer.state.top = d, n.length === 0) break;
|
|
489
|
+
let m = o.at(-1);
|
|
490
|
+
if (m?.type === "code") break;
|
|
491
|
+
if (m?.type === "blockquote") {
|
|
492
|
+
let b = m, g = n.join(`
|
|
493
|
+
`), w = b.raw + `
|
|
494
|
+
` + g.replace(this.rules.other.blockquoteSetextReplace2, ""), f = this.blockquote(w);
|
|
495
|
+
o[o.length - 1] = f;
|
|
496
|
+
let M = w.substring(f.raw.length).replace(/^\n/, ""), v = M ? M.split(`
|
|
497
|
+
`).length : 0, Z = v ? n.slice(0, -v) : n;
|
|
498
|
+
Z.length > 0 && (s = `${s}
|
|
499
|
+
${Z.join(`
|
|
500
|
+
`)}`), r = r.substring(0, r.length - b.text.length) + f.text;
|
|
501
|
+
break;
|
|
502
|
+
} else if (m?.type === "list") {
|
|
503
|
+
let b = m, g = b.raw + `
|
|
504
|
+
` + n.join(`
|
|
505
|
+
`), w = this.list(g);
|
|
506
|
+
o[o.length - 1] = w, s = s.substring(0, s.length - m.raw.length) + w.raw, r = r.substring(0, r.length - b.raw.length) + w.raw, n = g.substring(o.at(-1).raw.length).split(`
|
|
507
|
+
`);
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return {
|
|
512
|
+
type: "blockquote",
|
|
513
|
+
raw: s,
|
|
514
|
+
tokens: o,
|
|
515
|
+
text: r
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
list(e) {
|
|
520
|
+
let t = this.rules.block.list.exec(e);
|
|
521
|
+
if (t) {
|
|
522
|
+
let n = t[1].trim(), s = n.length > 1, r = {
|
|
523
|
+
type: "list",
|
|
524
|
+
raw: "",
|
|
525
|
+
ordered: s,
|
|
526
|
+
start: s ? +n.slice(0, -1) : "",
|
|
527
|
+
loose: !1,
|
|
528
|
+
items: []
|
|
529
|
+
};
|
|
530
|
+
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
531
|
+
let o = this.rules.other.listItemRegex(n), i = !1;
|
|
532
|
+
for (; e;) {
|
|
533
|
+
let a = !1, p = "", c = "";
|
|
534
|
+
if (!(t = o.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
535
|
+
p = t[0], e = e.substring(p.length);
|
|
536
|
+
let d = t[2].split(`
|
|
537
|
+
`, 1)[0], m = t[1].length, b = this.options.pedantic ? ae(d, m) : d.replace(this.rules.other.leadingSpaceTab, (M) => ae(M, m)), g = e.split(`
|
|
538
|
+
`, 1)[0], w = !b.trim(), f = 0;
|
|
539
|
+
if (this.options.pedantic ? (f = 2, c = b.trimStart()) : w ? f = m + 1 : (f = b.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = b.slice(f), f += m), w && this.rules.other.blankLine.test(g) && (p += g + `
|
|
540
|
+
`, e = e.substring(g.length + 1), a = !0), !a) {
|
|
541
|
+
let M = this.rules.other.nextBulletRegex(f), v = this.rules.other.hrRegex(f), Z = this.rules.other.fencesBeginRegex(f), le = this.rules.other.headingBeginRegex(f), Pe = this.rules.other.htmlBeginRegex(f), ye = this.rules.other.blockquoteBeginRegex(f);
|
|
542
|
+
for (; e;) {
|
|
543
|
+
let K = e.split(`
|
|
544
|
+
`, 1)[0], H;
|
|
545
|
+
if (g = K, this.options.pedantic ? (g = g.replace(this.rules.other.listReplaceNesting, " "), H = g) : H = g.replace(this.rules.other.leadingSpaceTab, (Se) => Se.replace(this.rules.other.tabCharGlobal, " ")), Z.test(g) || le.test(g) || Pe.test(g) || ye.test(g) || M.test(g) || v.test(g)) break;
|
|
546
|
+
if (H.search(this.rules.other.nonSpaceChar) >= f || !g.trim()) c += `
|
|
547
|
+
` + H.slice(f);
|
|
548
|
+
else {
|
|
549
|
+
if (w || b.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Z.test(b) || le.test(b) || v.test(b)) break;
|
|
550
|
+
c += `
|
|
551
|
+
` + g;
|
|
552
|
+
}
|
|
553
|
+
w = !g.trim(), p += K + `
|
|
554
|
+
`, e = e.substring(K.length + 1), b = H.slice(f);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
r.loose || (i ? r.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (i = !0)), r.items.push({
|
|
558
|
+
type: "list_item",
|
|
559
|
+
raw: p,
|
|
560
|
+
task: !!this.options.gfm && this.rules.other.listIsTask.test(c),
|
|
561
|
+
loose: !1,
|
|
562
|
+
text: c,
|
|
563
|
+
tokens: []
|
|
564
|
+
}), r.raw += p;
|
|
565
|
+
}
|
|
566
|
+
let u = r.items.at(-1);
|
|
567
|
+
if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
568
|
+
else return;
|
|
569
|
+
r.raw = r.raw.trimEnd();
|
|
570
|
+
for (let a of r.items) if (this.lexer.state.top = !1, a.tokens = this.lexer.blockTokens(a.text, []), !r.loose) {
|
|
571
|
+
let p = a.tokens.filter((d) => d.type === "space");
|
|
572
|
+
r.loose = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
573
|
+
}
|
|
574
|
+
for (let a of r.items) {
|
|
575
|
+
let p = a.tokens[0];
|
|
576
|
+
if (a.task && (p?.type === "text" || p?.type === "paragraph")) {
|
|
577
|
+
a.text = a.text.replace(this.rules.other.listReplaceTask, ""), p.raw = p.raw.replace(this.rules.other.listReplaceTask, ""), p.text = p.text.replace(this.rules.other.listReplaceTask, "");
|
|
578
|
+
for (let d = this.lexer.inlineQueue.length - 1; d >= 0; d--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)) {
|
|
579
|
+
this.lexer.inlineQueue[d].src = this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask, "");
|
|
580
|
+
break;
|
|
581
|
+
}
|
|
582
|
+
let c = this.rules.other.listTaskCheckbox.exec(a.raw);
|
|
583
|
+
if (c) {
|
|
584
|
+
let d = {
|
|
585
|
+
type: "checkbox",
|
|
586
|
+
raw: c[0] + " ",
|
|
587
|
+
checked: c[0] !== "[ ]"
|
|
588
|
+
};
|
|
589
|
+
a.checked = d.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = d.raw + a.tokens[0].raw, a.tokens[0].text = d.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(d)) : a.tokens.unshift({
|
|
590
|
+
type: "paragraph",
|
|
591
|
+
raw: d.raw,
|
|
592
|
+
text: d.raw,
|
|
593
|
+
tokens: [d]
|
|
594
|
+
}) : a.tokens.unshift(d);
|
|
595
|
+
}
|
|
596
|
+
} else a.task && (a.task = !1);
|
|
597
|
+
}
|
|
598
|
+
if (r.loose) for (let a of r.items) {
|
|
599
|
+
a.loose = !0;
|
|
600
|
+
for (let p of a.tokens) p.type === "text" && (p.type = "paragraph");
|
|
601
|
+
}
|
|
602
|
+
return r;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
html(e) {
|
|
606
|
+
let t = this.rules.block.html.exec(e);
|
|
607
|
+
if (t) {
|
|
608
|
+
let n = ie(t[0]);
|
|
609
|
+
return {
|
|
610
|
+
type: "html",
|
|
611
|
+
block: !0,
|
|
612
|
+
raw: n,
|
|
613
|
+
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
614
|
+
text: n
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
def(e) {
|
|
619
|
+
let t = this.rules.block.def.exec(e);
|
|
620
|
+
if (t) {
|
|
621
|
+
if (!this.rules.other.startAngleBracket.test(t[2]) && oe(t[2], "()") !== -1) return;
|
|
622
|
+
let n = q(t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
623
|
+
return {
|
|
624
|
+
type: "def",
|
|
625
|
+
tag: n,
|
|
626
|
+
raw: L(t[0], `
|
|
627
|
+
`),
|
|
628
|
+
href: s,
|
|
629
|
+
title: r
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
table(e) {
|
|
634
|
+
let t = this.rules.block.table.exec(e);
|
|
635
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
636
|
+
let n = se(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
637
|
+
`) : [], o = {
|
|
638
|
+
type: "table",
|
|
639
|
+
raw: L(t[0], `
|
|
640
|
+
`),
|
|
641
|
+
header: [],
|
|
642
|
+
align: [],
|
|
643
|
+
rows: []
|
|
644
|
+
};
|
|
645
|
+
if (n.length === s.length) {
|
|
646
|
+
for (let i of s) this.rules.other.tableAlignRight.test(i) ? o.align.push("right") : this.rules.other.tableAlignCenter.test(i) ? o.align.push("center") : this.rules.other.tableAlignLeft.test(i) ? o.align.push("left") : o.align.push(null);
|
|
647
|
+
for (let i = 0; i < n.length; i++) o.header.push({
|
|
648
|
+
text: n[i],
|
|
649
|
+
tokens: this.lexer.inline(n[i]),
|
|
650
|
+
header: !0,
|
|
651
|
+
align: o.align[i]
|
|
652
|
+
});
|
|
653
|
+
for (let i of r) o.rows.push(se(i, o.header.length).map((u, a) => ({
|
|
654
|
+
text: u,
|
|
655
|
+
tokens: this.lexer.inline(u),
|
|
656
|
+
header: !1,
|
|
657
|
+
align: o.align[a]
|
|
658
|
+
})));
|
|
659
|
+
return o;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
lheading(e) {
|
|
663
|
+
let t = this.rules.block.lheading.exec(e);
|
|
664
|
+
if (t) {
|
|
665
|
+
let n = t[1].trim();
|
|
666
|
+
return {
|
|
667
|
+
type: "heading",
|
|
668
|
+
raw: L(t[0], `
|
|
669
|
+
`),
|
|
670
|
+
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
671
|
+
text: n,
|
|
672
|
+
tokens: this.lexer.inline(n)
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
paragraph(e) {
|
|
677
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
678
|
+
if (t) {
|
|
679
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
680
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
681
|
+
return {
|
|
682
|
+
type: "paragraph",
|
|
683
|
+
raw: t[0],
|
|
684
|
+
text: n,
|
|
685
|
+
tokens: this.lexer.inline(n)
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
text(e) {
|
|
690
|
+
let t = this.rules.block.text.exec(e);
|
|
691
|
+
if (t) return {
|
|
692
|
+
type: "text",
|
|
693
|
+
raw: t[0],
|
|
694
|
+
text: t[0],
|
|
695
|
+
tokens: this.lexer.inline(t[0])
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
escape(e) {
|
|
699
|
+
let t = this.rules.inline.escape.exec(e);
|
|
700
|
+
if (t) return {
|
|
701
|
+
type: "escape",
|
|
702
|
+
raw: t[0],
|
|
703
|
+
text: t[1]
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
tag(e) {
|
|
707
|
+
let t = this.rules.inline.tag.exec(e);
|
|
708
|
+
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
709
|
+
type: "html",
|
|
710
|
+
raw: t[0],
|
|
711
|
+
inLink: this.lexer.state.inLink,
|
|
712
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
713
|
+
block: !1,
|
|
714
|
+
text: t[0]
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
link(e) {
|
|
718
|
+
if (this.lexer.state.linkParenPossible === !1) return;
|
|
719
|
+
let t = this.rules.inline.link.exec(e);
|
|
720
|
+
if (t) {
|
|
721
|
+
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
722
|
+
if (!this.options.pedantic && we(e, t[1], n, this.rules)) return;
|
|
723
|
+
let s = t[2].trim();
|
|
724
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(s)) {
|
|
725
|
+
if (!this.rules.other.endAngleBracket.test(s)) return;
|
|
726
|
+
let i = L(s.slice(0, -1), "\\");
|
|
727
|
+
if ((s.length - i.length) % 2 === 0) return;
|
|
728
|
+
} else {
|
|
729
|
+
let i = oe(t[2], "()");
|
|
730
|
+
if (i === -2) return;
|
|
731
|
+
if (i > -1) {
|
|
732
|
+
let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
733
|
+
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, a).trim(), t[3] = "";
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
let r = t[2], o = "";
|
|
737
|
+
if (this.options.pedantic) {
|
|
738
|
+
let i = this.rules.other.pedanticHrefTitle.exec(r);
|
|
739
|
+
i && (r = i[1], o = i[3]);
|
|
740
|
+
} else o = t[3] ? t[3].slice(1, -1) : "";
|
|
741
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(s) ? r = r.slice(1) : r = r.slice(1, -1)), Oe(t, {
|
|
742
|
+
href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
743
|
+
title: o && o.replace(this.rules.inline.anyPunctuation, "$1")
|
|
744
|
+
}, t[0], this.lexer, this.rules);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
reflink(e, t) {
|
|
748
|
+
let n;
|
|
749
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
750
|
+
let s = n[0].charAt(0) === "!" ? 2 : 1;
|
|
751
|
+
if (!this.options.pedantic && we(e, n[1], s, this.rules)) return;
|
|
752
|
+
let o = t[q((n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "))];
|
|
753
|
+
if (!o) {
|
|
754
|
+
let i = n[0].charAt(0);
|
|
755
|
+
return {
|
|
756
|
+
type: "text",
|
|
757
|
+
raw: i,
|
|
758
|
+
text: i
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
return Oe(n, o, n[0], this.lexer, this.rules);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
emStrong(e, t, n = "") {
|
|
765
|
+
let s = this.rules.inline.emStrongLDelim.exec(e);
|
|
766
|
+
if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
767
|
+
if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
768
|
+
let o = [...s[0]].length - 1, i, u, a = o, p = 0, c = s[0][0], d = n === c, m = c === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
769
|
+
for (m.lastIndex = 0, t = t.slice(-1 * e.length + o); (s = m.exec(t)) !== null;) {
|
|
770
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
771
|
+
if (u = [...i].length, s[3] || s[4]) {
|
|
772
|
+
a += u;
|
|
773
|
+
continue;
|
|
774
|
+
} else if (s[5] || s[6]) {
|
|
775
|
+
if (o % 3 && !((o + u) % 3)) {
|
|
776
|
+
p += u;
|
|
777
|
+
continue;
|
|
778
|
+
}
|
|
779
|
+
if (d) break;
|
|
780
|
+
}
|
|
781
|
+
if (a -= u, a > 0) continue;
|
|
782
|
+
u = Math.min(u, u + a + p);
|
|
783
|
+
let b = [...s[0]][0].length, g = e.slice(0, o + s.index + b + u);
|
|
784
|
+
if (Math.min(o, u) % 2) {
|
|
785
|
+
let f = g.slice(1, -1);
|
|
786
|
+
return {
|
|
787
|
+
type: "em",
|
|
788
|
+
raw: g,
|
|
789
|
+
text: f,
|
|
790
|
+
tokens: this.lexer.inlineTokens(f)
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
let w = g.slice(2, -2);
|
|
794
|
+
return {
|
|
795
|
+
type: "strong",
|
|
796
|
+
raw: g,
|
|
797
|
+
text: w,
|
|
798
|
+
tokens: this.lexer.inlineTokens(w)
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
codespan(e) {
|
|
804
|
+
let t = this.rules.inline.code.exec(e);
|
|
805
|
+
if (t) {
|
|
806
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
807
|
+
return s && r && (n = n.substring(1, n.length - 1)), {
|
|
808
|
+
type: "codespan",
|
|
809
|
+
raw: t[0],
|
|
810
|
+
text: n
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
br(e) {
|
|
815
|
+
let t = this.rules.inline.br.exec(e);
|
|
816
|
+
if (t) return {
|
|
817
|
+
type: "br",
|
|
818
|
+
raw: t[0]
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
del(e, t, n = "") {
|
|
822
|
+
let s = this.rules.inline.delLDelim.exec(e);
|
|
823
|
+
if (!s) return;
|
|
824
|
+
if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
825
|
+
let o = [...s[0]].length - 1, i, u, a = o, p = this.rules.inline.delRDelim;
|
|
826
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + o); (s = p.exec(t)) !== null;) {
|
|
827
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (u = [...i].length, u !== o)) continue;
|
|
828
|
+
if (s[3] || s[4]) {
|
|
829
|
+
a += u;
|
|
830
|
+
continue;
|
|
831
|
+
}
|
|
832
|
+
if (a -= u, a > 0) continue;
|
|
833
|
+
u = Math.min(u, u + a);
|
|
834
|
+
let c = [...s[0]][0].length, d = e.slice(0, o + s.index + c + u), m = d.slice(o, -o);
|
|
835
|
+
return {
|
|
836
|
+
type: "del",
|
|
837
|
+
raw: d,
|
|
838
|
+
text: m,
|
|
839
|
+
tokens: this.lexer.inlineTokens(m)
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
autolink(e) {
|
|
845
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
846
|
+
if (t) {
|
|
847
|
+
let n, s;
|
|
848
|
+
return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), {
|
|
849
|
+
type: "link",
|
|
850
|
+
raw: t[0],
|
|
851
|
+
text: n,
|
|
852
|
+
href: s,
|
|
853
|
+
autolink: !0,
|
|
854
|
+
tokens: [{
|
|
855
|
+
type: "text",
|
|
856
|
+
raw: n,
|
|
857
|
+
text: n
|
|
858
|
+
}]
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
url(e) {
|
|
863
|
+
let t;
|
|
864
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
865
|
+
let n, s;
|
|
866
|
+
if (t[2] === "@") n = t[0], s = "mailto:" + n;
|
|
867
|
+
else {
|
|
868
|
+
let r;
|
|
869
|
+
do
|
|
870
|
+
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
871
|
+
while (r !== t[0]);
|
|
872
|
+
n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
873
|
+
}
|
|
874
|
+
return {
|
|
875
|
+
type: "link",
|
|
876
|
+
raw: t[0],
|
|
877
|
+
text: n,
|
|
878
|
+
href: s,
|
|
879
|
+
autolink: !0,
|
|
880
|
+
tokens: [{
|
|
881
|
+
type: "text",
|
|
882
|
+
raw: n,
|
|
883
|
+
text: n
|
|
884
|
+
}]
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
inlineText(e) {
|
|
889
|
+
let t = this.rules.inline.text.exec(e);
|
|
890
|
+
if (t) {
|
|
891
|
+
let n = this.lexer.state.inRawBlock;
|
|
892
|
+
return {
|
|
893
|
+
type: "text",
|
|
894
|
+
raw: t[0],
|
|
895
|
+
text: n ? t[0] : Te(t[0]),
|
|
896
|
+
escaped: n
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
var R = class l {
|
|
902
|
+
tokens;
|
|
903
|
+
options;
|
|
904
|
+
state;
|
|
905
|
+
inlineQueue;
|
|
906
|
+
tokenizer;
|
|
907
|
+
constructor(e) {
|
|
908
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || P, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
909
|
+
inLink: !1,
|
|
910
|
+
inRawBlock: !1,
|
|
911
|
+
linkEmitted: !1,
|
|
912
|
+
linkParenPossible: !0,
|
|
913
|
+
top: !0
|
|
914
|
+
};
|
|
915
|
+
let t = {
|
|
916
|
+
other: x,
|
|
917
|
+
block: j.normal,
|
|
918
|
+
inline: D.normal
|
|
919
|
+
};
|
|
920
|
+
this.options.pedantic ? (t.block = j.pedantic, t.inline = D.pedantic) : this.options.gfm && (t.block = j.gfm, this.options.breaks ? t.inline = D.breaks : t.inline = D.gfm), this.tokenizer.rules = t;
|
|
921
|
+
}
|
|
922
|
+
static get rules() {
|
|
923
|
+
return {
|
|
924
|
+
block: j,
|
|
925
|
+
inline: D
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
static lex(e, t) {
|
|
929
|
+
return new l(t).lex(e);
|
|
930
|
+
}
|
|
931
|
+
static lexInline(e, t) {
|
|
932
|
+
return new l(t).inlineTokens(e);
|
|
933
|
+
}
|
|
934
|
+
lex(e) {
|
|
935
|
+
e = e.replace(x.carriageReturn, `
|
|
936
|
+
`), this.blockTokens(e, this.tokens);
|
|
937
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
938
|
+
let n = this.inlineQueue[t];
|
|
939
|
+
this.inlineTokens(n.src, n.tokens);
|
|
940
|
+
}
|
|
941
|
+
return this.inlineQueue = [], this.tokens;
|
|
942
|
+
}
|
|
943
|
+
blockTokens(e, t = [], n = !1) {
|
|
944
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(x.tabCharGlobal, " ").replace(x.spaceLine, ""));
|
|
945
|
+
let s = 1 / 0;
|
|
946
|
+
for (; e;) {
|
|
947
|
+
if (e.length < s) s = e.length;
|
|
948
|
+
else {
|
|
949
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
950
|
+
break;
|
|
951
|
+
}
|
|
952
|
+
let r;
|
|
953
|
+
if (this.options.extensions?.block?.some((i) => (r = i.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
954
|
+
if (r = this.tokenizer.space(e)) {
|
|
955
|
+
e = e.substring(r.raw.length);
|
|
956
|
+
let i = t.at(-1);
|
|
957
|
+
r.raw.length === 1 && i !== void 0 ? i.raw += `
|
|
958
|
+
` : t.push(r);
|
|
959
|
+
continue;
|
|
960
|
+
}
|
|
961
|
+
if (r = this.tokenizer.code(e)) {
|
|
962
|
+
e = e.substring(r.raw.length);
|
|
963
|
+
let i = t.at(-1);
|
|
964
|
+
i?.type === "paragraph" || i?.type === "text" ? (i.raw += (i.raw.endsWith(`
|
|
965
|
+
`) ? "" : `
|
|
966
|
+
`) + r.raw, i.text += `
|
|
967
|
+
` + r.text, this.inlineQueue.at(-1).src = i.text) : t.push(r);
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
970
|
+
if (r = this.tokenizer.fences(e)) {
|
|
971
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
972
|
+
continue;
|
|
973
|
+
}
|
|
974
|
+
if (r = this.tokenizer.heading(e)) {
|
|
975
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
976
|
+
continue;
|
|
977
|
+
}
|
|
978
|
+
if (r = this.tokenizer.hr(e)) {
|
|
979
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
980
|
+
continue;
|
|
981
|
+
}
|
|
982
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
983
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
984
|
+
continue;
|
|
985
|
+
}
|
|
986
|
+
if (r = this.tokenizer.list(e)) {
|
|
987
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
988
|
+
continue;
|
|
989
|
+
}
|
|
990
|
+
if (r = this.tokenizer.html(e)) {
|
|
991
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
992
|
+
continue;
|
|
993
|
+
}
|
|
994
|
+
if (r = this.tokenizer.def(e)) {
|
|
995
|
+
e = e.substring(r.raw.length);
|
|
996
|
+
let i = t.at(-1);
|
|
997
|
+
i?.type === "paragraph" || i?.type === "text" ? (i.raw += (i.raw.endsWith(`
|
|
998
|
+
`) ? "" : `
|
|
999
|
+
`) + r.raw, i.text += `
|
|
1000
|
+
` + r.raw, this.inlineQueue.at(-1).src = i.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
|
|
1001
|
+
href: r.href,
|
|
1002
|
+
title: r.title
|
|
1003
|
+
}, t.push(r));
|
|
1004
|
+
continue;
|
|
1005
|
+
}
|
|
1006
|
+
if (r = this.tokenizer.table(e)) {
|
|
1007
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1008
|
+
continue;
|
|
1009
|
+
}
|
|
1010
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
1011
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1012
|
+
continue;
|
|
1013
|
+
}
|
|
1014
|
+
let o = e;
|
|
1015
|
+
if (this.options.extensions?.startBlock) {
|
|
1016
|
+
let i = 1 / 0, u = e.slice(1), a;
|
|
1017
|
+
this.options.extensions.startBlock.forEach((p) => {
|
|
1018
|
+
a = p.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (i = Math.min(i, a));
|
|
1019
|
+
}), i < 1 / 0 && i >= 0 && (o = e.substring(0, i + 1));
|
|
1020
|
+
}
|
|
1021
|
+
if (this.state.top && (r = this.tokenizer.paragraph(o))) {
|
|
1022
|
+
let i = t.at(-1);
|
|
1023
|
+
n && i?.type === "paragraph" ? (i.raw += (i.raw.endsWith(`
|
|
1024
|
+
`) ? "" : `
|
|
1025
|
+
`) + r.raw, i.text += `
|
|
1026
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : t.push(r), n = o.length !== e.length, e = e.substring(r.raw.length);
|
|
1027
|
+
continue;
|
|
1028
|
+
}
|
|
1029
|
+
if (r = this.tokenizer.text(e)) {
|
|
1030
|
+
e = e.substring(r.raw.length);
|
|
1031
|
+
let i = t.at(-1);
|
|
1032
|
+
i?.type === "text" ? (i.raw += (i.raw.endsWith(`
|
|
1033
|
+
`) ? "" : `
|
|
1034
|
+
`) + r.raw, i.text += `
|
|
1035
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : t.push(r);
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
if (e) {
|
|
1039
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
return this.state.top = !0, t;
|
|
1044
|
+
}
|
|
1045
|
+
inline(e, t = []) {
|
|
1046
|
+
return this.inlineQueue.push({
|
|
1047
|
+
src: e,
|
|
1048
|
+
tokens: t
|
|
1049
|
+
}), t;
|
|
1050
|
+
}
|
|
1051
|
+
linkInText(e) {
|
|
1052
|
+
if (!e.includes("[")) return !1;
|
|
1053
|
+
let t = this.tokenizer.rules.inline.link;
|
|
1054
|
+
for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return !0;
|
|
1055
|
+
for (let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
1056
|
+
let s = n[0], r = s.lastIndexOf("[");
|
|
1057
|
+
if (!(s.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, q(s.slice(r + 1, -1)))) && !(r > 1 && this.linkInText(s.slice(1, r - 1)))) return !0;
|
|
1058
|
+
}
|
|
1059
|
+
return !1;
|
|
1060
|
+
}
|
|
1061
|
+
inlineTokens(e, t = []) {
|
|
1062
|
+
this.tokenizer.lexer = this;
|
|
1063
|
+
let n = this.state.linkParenPossible;
|
|
1064
|
+
this.state.linkParenPossible = n && e.includes(")");
|
|
1065
|
+
try {
|
|
1066
|
+
return this.#e(e, t);
|
|
1067
|
+
} finally {
|
|
1068
|
+
this.state.linkParenPossible = n;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
#e(e, t) {
|
|
1072
|
+
let n = e;
|
|
1073
|
+
if (this.tokens.links && e.includes("[")) {
|
|
1074
|
+
let i = this.tokenizer.rules.inline.reflinkSearch, u = (a) => {
|
|
1075
|
+
let p = a.lastIndexOf("[");
|
|
1076
|
+
if (!Object.hasOwn(this.tokens.links, q(a.slice(p + 1, -1)))) return a;
|
|
1077
|
+
if (p > 1 && a.charAt(0) !== "!") {
|
|
1078
|
+
let c = a.slice(1, p - 1);
|
|
1079
|
+
if (this.linkInText(c)) return "[" + c.replace(i, u) + "][" + "a".repeat(a.length - p - 2) + "]";
|
|
1080
|
+
}
|
|
1081
|
+
return "[" + "a".repeat(a.length - 2) + "]";
|
|
1082
|
+
};
|
|
1083
|
+
n = n.replace(i, u);
|
|
1084
|
+
}
|
|
1085
|
+
n = n.replace(this.tokenizer.rules.inline.anyPunctuation, (i) => "+".repeat(i.length)), n = n.replace(this.tokenizer.rules.inline.blockSkip, (i, u, a) => {
|
|
1086
|
+
let p = a ? a.length : 0;
|
|
1087
|
+
return i.slice(0, p) + "[" + "a".repeat(i.length - p - 2) + "]";
|
|
1088
|
+
}), n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
1089
|
+
let s = !1, r = "", o = 1 / 0;
|
|
1090
|
+
for (; e;) {
|
|
1091
|
+
if (e.length < o) o = e.length;
|
|
1092
|
+
else {
|
|
1093
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
s || (r = ""), s = !1;
|
|
1097
|
+
let i;
|
|
1098
|
+
if (this.options.extensions?.inline?.some((a) => (i = a.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), !0) : !1)) continue;
|
|
1099
|
+
if (i = this.tokenizer.escape(e)) {
|
|
1100
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1101
|
+
continue;
|
|
1102
|
+
}
|
|
1103
|
+
if (i = this.tokenizer.tag(e)) {
|
|
1104
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1105
|
+
continue;
|
|
1106
|
+
}
|
|
1107
|
+
if (i = this.tokenizer.link(e)) {
|
|
1108
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1109
|
+
continue;
|
|
1110
|
+
}
|
|
1111
|
+
if (i = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1112
|
+
e = e.substring(i.raw.length);
|
|
1113
|
+
let a = t.at(-1);
|
|
1114
|
+
i.type === "text" && a?.type === "text" ? (a.raw += i.raw, a.text += i.text) : t.push(i);
|
|
1115
|
+
continue;
|
|
1116
|
+
}
|
|
1117
|
+
if (i = this.tokenizer.emStrong(e, n, r)) {
|
|
1118
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1119
|
+
continue;
|
|
1120
|
+
}
|
|
1121
|
+
if (i = this.tokenizer.codespan(e)) {
|
|
1122
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
if (i = this.tokenizer.br(e)) {
|
|
1126
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
if (i = this.tokenizer.del(e, n, r)) {
|
|
1130
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1131
|
+
continue;
|
|
1132
|
+
}
|
|
1133
|
+
if (i = this.tokenizer.autolink(e)) {
|
|
1134
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1135
|
+
continue;
|
|
1136
|
+
}
|
|
1137
|
+
if (!this.state.inLink && (i = this.tokenizer.url(e))) {
|
|
1138
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1139
|
+
continue;
|
|
1140
|
+
}
|
|
1141
|
+
let u = e;
|
|
1142
|
+
if (this.options.extensions?.startInline) {
|
|
1143
|
+
let a = 1 / 0, p = e.slice(1), c;
|
|
1144
|
+
this.options.extensions.startInline.forEach((d) => {
|
|
1145
|
+
c = d.call({ lexer: this }, p), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
|
|
1146
|
+
}), a < 1 / 0 && a >= 0 && (u = e.substring(0, a + 1));
|
|
1147
|
+
}
|
|
1148
|
+
if (i = this.tokenizer.inlineText(u)) {
|
|
1149
|
+
e = e.substring(i.raw.length), i.raw.slice(-1) !== "_" && (r = i.raw.slice(-1)), s = !0;
|
|
1150
|
+
let a = t.at(-1);
|
|
1151
|
+
a?.type === "text" ? (a.raw += i.raw, a.text += i.text) : t.push(i);
|
|
1152
|
+
continue;
|
|
1153
|
+
}
|
|
1154
|
+
if (e) {
|
|
1155
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1156
|
+
break;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
return t;
|
|
1160
|
+
}
|
|
1161
|
+
infiniteLoopError(e) {
|
|
1162
|
+
let t = "Infinite loop on byte: " + e;
|
|
1163
|
+
if (this.options.silent) console.error(t);
|
|
1164
|
+
else throw new Error(t);
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
var S = class {
|
|
1168
|
+
options;
|
|
1169
|
+
parser;
|
|
1170
|
+
constructor(e) {
|
|
1171
|
+
this.options = e || P;
|
|
1172
|
+
}
|
|
1173
|
+
space(e) {
|
|
1174
|
+
return "";
|
|
1175
|
+
}
|
|
1176
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
1177
|
+
let s = (t || "").match(x.notSpaceStart)?.[0], r = e ? e.replace(x.endingNewline, "") + `
|
|
1178
|
+
` : "";
|
|
1179
|
+
return s ? "<pre><code class=\"language-" + O(s) + "\">" + (n ? r : O(r, !0)) + `</code></pre>
|
|
1180
|
+
` : "<pre><code>" + (n ? r : O(r, !0)) + `</code></pre>
|
|
1181
|
+
`;
|
|
1182
|
+
}
|
|
1183
|
+
blockquote({ tokens: e }) {
|
|
1184
|
+
return `<blockquote>
|
|
1185
|
+
${this.parser.parse(e)}</blockquote>
|
|
1186
|
+
`;
|
|
1187
|
+
}
|
|
1188
|
+
html({ text: e }) {
|
|
1189
|
+
return e;
|
|
1190
|
+
}
|
|
1191
|
+
def(e) {
|
|
1192
|
+
return "";
|
|
1193
|
+
}
|
|
1194
|
+
heading({ tokens: e, depth: t }) {
|
|
1195
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1196
|
+
`;
|
|
1197
|
+
}
|
|
1198
|
+
hr(e) {
|
|
1199
|
+
return `<hr>
|
|
1200
|
+
`;
|
|
1201
|
+
}
|
|
1202
|
+
list(e) {
|
|
1203
|
+
let t = e.ordered, n = e.start, s = "";
|
|
1204
|
+
for (let i = 0; i < e.items.length; i++) {
|
|
1205
|
+
let u = e.items[i];
|
|
1206
|
+
s += this.listitem(u);
|
|
1207
|
+
}
|
|
1208
|
+
let r = t ? "ol" : "ul", o = t && n !== 1 ? " start=\"" + n + "\"" : "";
|
|
1209
|
+
return "<" + r + o + `>
|
|
1210
|
+
` + s + "</" + r + `>
|
|
1211
|
+
`;
|
|
1212
|
+
}
|
|
1213
|
+
listitem(e) {
|
|
1214
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
1215
|
+
`;
|
|
1216
|
+
}
|
|
1217
|
+
checkbox({ checked: e }) {
|
|
1218
|
+
return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
|
|
1219
|
+
}
|
|
1220
|
+
paragraph({ tokens: e }) {
|
|
1221
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
1222
|
+
`;
|
|
1223
|
+
}
|
|
1224
|
+
table(e) {
|
|
1225
|
+
let t = "", n = "";
|
|
1226
|
+
for (let r = 0; r < e.header.length; r++) n += this.tablecell(e.header[r]);
|
|
1227
|
+
t += this.tablerow({ text: n });
|
|
1228
|
+
let s = "";
|
|
1229
|
+
for (let r = 0; r < e.rows.length; r++) {
|
|
1230
|
+
let o = e.rows[r];
|
|
1231
|
+
n = "";
|
|
1232
|
+
for (let i = 0; i < o.length; i++) n += this.tablecell(o[i]);
|
|
1233
|
+
s += this.tablerow({ text: n });
|
|
1234
|
+
}
|
|
1235
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
1236
|
+
<thead>
|
|
1237
|
+
` + t + `</thead>
|
|
1238
|
+
` + s + `</table>
|
|
1239
|
+
`;
|
|
1240
|
+
}
|
|
1241
|
+
tablerow({ text: e }) {
|
|
1242
|
+
return `<tr>
|
|
1243
|
+
${e}</tr>
|
|
1244
|
+
`;
|
|
1245
|
+
}
|
|
1246
|
+
tablecell(e) {
|
|
1247
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
1248
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
1249
|
+
`;
|
|
1250
|
+
}
|
|
1251
|
+
strong({ tokens: e }) {
|
|
1252
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
1253
|
+
}
|
|
1254
|
+
em({ tokens: e }) {
|
|
1255
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1256
|
+
}
|
|
1257
|
+
codespan({ text: e }) {
|
|
1258
|
+
return `<code>${O(e, !0)}</code>`;
|
|
1259
|
+
}
|
|
1260
|
+
br(e) {
|
|
1261
|
+
return "<br>";
|
|
1262
|
+
}
|
|
1263
|
+
del({ tokens: e }) {
|
|
1264
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1265
|
+
}
|
|
1266
|
+
link({ href: e, title: t, text: n, tokens: s, autolink: r }) {
|
|
1267
|
+
let o = r ? O(n, !0) : this.parser.parseInline(s), i = re(e);
|
|
1268
|
+
if (i === null) return o;
|
|
1269
|
+
e = O(i, r);
|
|
1270
|
+
let u = "<a href=\"" + e + "\"";
|
|
1271
|
+
return t && (u += " title=\"" + O(t) + "\""), u += ">" + o + "</a>", u;
|
|
1272
|
+
}
|
|
1273
|
+
image({ href: e, title: t, text: n, tokens: s }) {
|
|
1274
|
+
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
1275
|
+
let r = re(e);
|
|
1276
|
+
if (r === null) return O(n);
|
|
1277
|
+
e = r;
|
|
1278
|
+
let o = `<img src="${O(e)}" alt="${O(n)}"`;
|
|
1279
|
+
return t && (o += ` title="${O(t)}"`), o += ">", o;
|
|
1280
|
+
}
|
|
1281
|
+
text(e) {
|
|
1282
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1285
|
+
var z = class {
|
|
1286
|
+
strong({ text: e }) {
|
|
1287
|
+
return e;
|
|
1288
|
+
}
|
|
1289
|
+
em({ text: e }) {
|
|
1290
|
+
return e;
|
|
1291
|
+
}
|
|
1292
|
+
codespan({ text: e }) {
|
|
1293
|
+
return e;
|
|
1294
|
+
}
|
|
1295
|
+
del({ text: e }) {
|
|
1296
|
+
return e;
|
|
1297
|
+
}
|
|
1298
|
+
html({ text: e }) {
|
|
1299
|
+
return e;
|
|
1300
|
+
}
|
|
1301
|
+
text({ text: e }) {
|
|
1302
|
+
return e;
|
|
1303
|
+
}
|
|
1304
|
+
link({ text: e }) {
|
|
1305
|
+
return "" + e;
|
|
1306
|
+
}
|
|
1307
|
+
image({ text: e }) {
|
|
1308
|
+
return "" + e;
|
|
1309
|
+
}
|
|
1310
|
+
br() {
|
|
1311
|
+
return "";
|
|
1312
|
+
}
|
|
1313
|
+
checkbox({ raw: e }) {
|
|
1314
|
+
return e;
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
var T = class l {
|
|
1318
|
+
options;
|
|
1319
|
+
renderer;
|
|
1320
|
+
textRenderer;
|
|
1321
|
+
constructor(e) {
|
|
1322
|
+
this.options = e || P, this.options.renderer = this.options.renderer || new S(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new z();
|
|
1323
|
+
}
|
|
1324
|
+
static parse(e, t) {
|
|
1325
|
+
return new l(t).parse(e);
|
|
1326
|
+
}
|
|
1327
|
+
static parseInline(e, t) {
|
|
1328
|
+
return new l(t).parseInline(e);
|
|
1329
|
+
}
|
|
1330
|
+
parse(e) {
|
|
1331
|
+
this.renderer.parser = this;
|
|
1332
|
+
let t = "";
|
|
1333
|
+
for (let n = 0; n < e.length; n++) {
|
|
1334
|
+
let s = e[n];
|
|
1335
|
+
if (this.options.extensions?.renderers?.[s.type]) {
|
|
1336
|
+
let o = s, i = this.options.extensions.renderers[o.type].call({ parser: this }, o);
|
|
1337
|
+
if (i !== !1 || ![
|
|
1338
|
+
"space",
|
|
1339
|
+
"hr",
|
|
1340
|
+
"heading",
|
|
1341
|
+
"code",
|
|
1342
|
+
"table",
|
|
1343
|
+
"blockquote",
|
|
1344
|
+
"list",
|
|
1345
|
+
"checkbox",
|
|
1346
|
+
"html",
|
|
1347
|
+
"def",
|
|
1348
|
+
"paragraph",
|
|
1349
|
+
"text"
|
|
1350
|
+
].includes(o.type)) {
|
|
1351
|
+
t += i || "";
|
|
1352
|
+
continue;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
let r = s;
|
|
1356
|
+
switch (r.type) {
|
|
1357
|
+
case "space":
|
|
1358
|
+
t += this.renderer.space(r);
|
|
1359
|
+
break;
|
|
1360
|
+
case "hr":
|
|
1361
|
+
t += this.renderer.hr(r);
|
|
1362
|
+
break;
|
|
1363
|
+
case "heading":
|
|
1364
|
+
t += this.renderer.heading(r);
|
|
1365
|
+
break;
|
|
1366
|
+
case "code":
|
|
1367
|
+
t += this.renderer.code(r);
|
|
1368
|
+
break;
|
|
1369
|
+
case "table":
|
|
1370
|
+
t += this.renderer.table(r);
|
|
1371
|
+
break;
|
|
1372
|
+
case "blockquote":
|
|
1373
|
+
t += this.renderer.blockquote(r);
|
|
1374
|
+
break;
|
|
1375
|
+
case "list":
|
|
1376
|
+
t += this.renderer.list(r);
|
|
1377
|
+
break;
|
|
1378
|
+
case "checkbox":
|
|
1379
|
+
t += this.renderer.checkbox(r);
|
|
1380
|
+
break;
|
|
1381
|
+
case "html":
|
|
1382
|
+
t += this.renderer.html(r);
|
|
1383
|
+
break;
|
|
1384
|
+
case "def":
|
|
1385
|
+
t += this.renderer.def(r);
|
|
1386
|
+
break;
|
|
1387
|
+
case "paragraph":
|
|
1388
|
+
t += this.renderer.paragraph(r);
|
|
1389
|
+
break;
|
|
1390
|
+
case "text":
|
|
1391
|
+
t += this.renderer.text(r);
|
|
1392
|
+
break;
|
|
1393
|
+
default: {
|
|
1394
|
+
let o = "Token with \"" + r.type + "\" type was not found.";
|
|
1395
|
+
if (this.options.silent) return console.error(o), "";
|
|
1396
|
+
throw new Error(o);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return t;
|
|
1401
|
+
}
|
|
1402
|
+
parseInline(e, t = this.renderer) {
|
|
1403
|
+
this.renderer.parser = this;
|
|
1404
|
+
let n = "";
|
|
1405
|
+
for (let s = 0; s < e.length; s++) {
|
|
1406
|
+
let r = e[s];
|
|
1407
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
1408
|
+
let i = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
1409
|
+
if (i !== !1 || ![
|
|
1410
|
+
"escape",
|
|
1411
|
+
"html",
|
|
1412
|
+
"link",
|
|
1413
|
+
"image",
|
|
1414
|
+
"checkbox",
|
|
1415
|
+
"strong",
|
|
1416
|
+
"em",
|
|
1417
|
+
"codespan",
|
|
1418
|
+
"br",
|
|
1419
|
+
"del",
|
|
1420
|
+
"text"
|
|
1421
|
+
].includes(r.type)) {
|
|
1422
|
+
n += i || "";
|
|
1423
|
+
continue;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
let o = r;
|
|
1427
|
+
switch (o.type) {
|
|
1428
|
+
case "escape":
|
|
1429
|
+
n += t.text(o);
|
|
1430
|
+
break;
|
|
1431
|
+
case "html":
|
|
1432
|
+
n += t.html(o);
|
|
1433
|
+
break;
|
|
1434
|
+
case "link":
|
|
1435
|
+
n += t.link(o);
|
|
1436
|
+
break;
|
|
1437
|
+
case "image":
|
|
1438
|
+
n += t.image(o);
|
|
1439
|
+
break;
|
|
1440
|
+
case "checkbox":
|
|
1441
|
+
n += t.checkbox(o);
|
|
1442
|
+
break;
|
|
1443
|
+
case "strong":
|
|
1444
|
+
n += t.strong(o);
|
|
1445
|
+
break;
|
|
1446
|
+
case "em":
|
|
1447
|
+
n += t.em(o);
|
|
1448
|
+
break;
|
|
1449
|
+
case "codespan":
|
|
1450
|
+
n += t.codespan(o);
|
|
1451
|
+
break;
|
|
1452
|
+
case "br":
|
|
1453
|
+
n += t.br(o);
|
|
1454
|
+
break;
|
|
1455
|
+
case "del":
|
|
1456
|
+
n += t.del(o);
|
|
1457
|
+
break;
|
|
1458
|
+
case "text":
|
|
1459
|
+
n += t.text(o);
|
|
1460
|
+
break;
|
|
1461
|
+
default: {
|
|
1462
|
+
let i = "Token with \"" + o.type + "\" type was not found.";
|
|
1463
|
+
if (this.options.silent) return console.error(i), "";
|
|
1464
|
+
throw new Error(i);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
return n;
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
var _ = class {
|
|
1472
|
+
options;
|
|
1473
|
+
block;
|
|
1474
|
+
constructor(e) {
|
|
1475
|
+
this.options = e || P;
|
|
1476
|
+
}
|
|
1477
|
+
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
1478
|
+
"preprocess",
|
|
1479
|
+
"postprocess",
|
|
1480
|
+
"processAllTokens",
|
|
1481
|
+
"emStrongMask"
|
|
1482
|
+
]);
|
|
1483
|
+
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set([
|
|
1484
|
+
"preprocess",
|
|
1485
|
+
"postprocess",
|
|
1486
|
+
"processAllTokens"
|
|
1487
|
+
]);
|
|
1488
|
+
preprocess(e) {
|
|
1489
|
+
return e;
|
|
1490
|
+
}
|
|
1491
|
+
postprocess(e) {
|
|
1492
|
+
return e;
|
|
1493
|
+
}
|
|
1494
|
+
processAllTokens(e) {
|
|
1495
|
+
return e;
|
|
1496
|
+
}
|
|
1497
|
+
emStrongMask(e) {
|
|
1498
|
+
return e;
|
|
1499
|
+
}
|
|
1500
|
+
provideLexer(e = this.block) {
|
|
1501
|
+
return e ? R.lex : R.lexInline;
|
|
1502
|
+
}
|
|
1503
|
+
provideParser(e = this.block) {
|
|
1504
|
+
return e ? T.parse : T.parseInline;
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
var F = class {
|
|
1508
|
+
defaults = I();
|
|
1509
|
+
options = this.setOptions;
|
|
1510
|
+
parse = this.parseMarkdown(!0);
|
|
1511
|
+
parseInline = this.parseMarkdown(!1);
|
|
1512
|
+
Parser = T;
|
|
1513
|
+
Renderer = S;
|
|
1514
|
+
TextRenderer = z;
|
|
1515
|
+
Lexer = R;
|
|
1516
|
+
Tokenizer = y;
|
|
1517
|
+
Hooks = _;
|
|
1518
|
+
constructor(...e) {
|
|
1519
|
+
this.use(...e);
|
|
1520
|
+
}
|
|
1521
|
+
walkTokens(e, t) {
|
|
1522
|
+
let n = [];
|
|
1523
|
+
for (let s of e) switch (n = n.concat(t.call(this, s)), s.type) {
|
|
1524
|
+
case "table": {
|
|
1525
|
+
let r = s;
|
|
1526
|
+
for (let o of r.header) n = n.concat(this.walkTokens(o.tokens, t));
|
|
1527
|
+
for (let o of r.rows) for (let i of o) n = n.concat(this.walkTokens(i.tokens, t));
|
|
1528
|
+
break;
|
|
1529
|
+
}
|
|
1530
|
+
case "list": {
|
|
1531
|
+
let r = s;
|
|
1532
|
+
n = n.concat(this.walkTokens(r.items, t));
|
|
1533
|
+
break;
|
|
1534
|
+
}
|
|
1535
|
+
default: {
|
|
1536
|
+
let r = s;
|
|
1537
|
+
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((o) => {
|
|
1538
|
+
let i = r[o].flat(1 / 0);
|
|
1539
|
+
n = n.concat(this.walkTokens(i, t));
|
|
1540
|
+
}) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
return n;
|
|
1544
|
+
}
|
|
1545
|
+
use(...e) {
|
|
1546
|
+
let t = this.defaults.extensions || {
|
|
1547
|
+
renderers: {},
|
|
1548
|
+
childTokens: {}
|
|
1549
|
+
};
|
|
1550
|
+
return e.forEach((n) => {
|
|
1551
|
+
let s = { ...n };
|
|
1552
|
+
if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.extensions.forEach((r) => {
|
|
1553
|
+
if (!r.name) throw new Error("extension name required");
|
|
1554
|
+
if ("renderer" in r) {
|
|
1555
|
+
let o = t.renderers[r.name];
|
|
1556
|
+
o ? t.renderers[r.name] = function(...i) {
|
|
1557
|
+
let u = r.renderer.apply(this, i);
|
|
1558
|
+
return u === !1 && (u = o.apply(this, i)), u;
|
|
1559
|
+
} : t.renderers[r.name] = r.renderer;
|
|
1560
|
+
}
|
|
1561
|
+
if ("tokenizer" in r) {
|
|
1562
|
+
if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1563
|
+
let o = t[r.level];
|
|
1564
|
+
o ? o.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
|
|
1565
|
+
}
|
|
1566
|
+
"childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
|
|
1567
|
+
}), s.extensions = t), n.renderer) {
|
|
1568
|
+
let r = this.defaults.renderer || new S(this.defaults);
|
|
1569
|
+
for (let o in n.renderer) {
|
|
1570
|
+
if (!(o in r)) throw new Error(`renderer '${o}' does not exist`);
|
|
1571
|
+
if (["options", "parser"].includes(o)) continue;
|
|
1572
|
+
let i = o, u = n.renderer[i], a = r[i];
|
|
1573
|
+
r[i] = (...p) => {
|
|
1574
|
+
let c = u.apply(r, p);
|
|
1575
|
+
return c === !1 && (c = a.apply(r, p)), c || "";
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
s.renderer = r;
|
|
1579
|
+
}
|
|
1580
|
+
if (n.tokenizer) {
|
|
1581
|
+
let r = this.defaults.tokenizer || new y(this.defaults);
|
|
1582
|
+
for (let o in n.tokenizer) {
|
|
1583
|
+
if (!(o in r)) throw new Error(`tokenizer '${o}' does not exist`);
|
|
1584
|
+
if ([
|
|
1585
|
+
"options",
|
|
1586
|
+
"rules",
|
|
1587
|
+
"lexer"
|
|
1588
|
+
].includes(o)) continue;
|
|
1589
|
+
let i = o, u = n.tokenizer[i], a = r[i];
|
|
1590
|
+
r[i] = (...p) => {
|
|
1591
|
+
let c = u.apply(r, p);
|
|
1592
|
+
return c === !1 && (c = a.apply(r, p)), c;
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
s.tokenizer = r;
|
|
1596
|
+
}
|
|
1597
|
+
if (n.hooks) {
|
|
1598
|
+
let r = this.defaults.hooks || new _();
|
|
1599
|
+
for (let o in n.hooks) {
|
|
1600
|
+
if (!(o in r)) throw new Error(`hook '${o}' does not exist`);
|
|
1601
|
+
if (["options", "block"].includes(o)) continue;
|
|
1602
|
+
let i = o, u = n.hooks[i], a = r[i];
|
|
1603
|
+
_.passThroughHooks.has(o) ? r[i] = (p) => {
|
|
1604
|
+
if (this.defaults.async && _.passThroughHooksRespectAsync.has(o)) return (async () => {
|
|
1605
|
+
let d = await u.call(r, p);
|
|
1606
|
+
return a.call(r, d);
|
|
1607
|
+
})();
|
|
1608
|
+
let c = u.call(r, p);
|
|
1609
|
+
return a.call(r, c);
|
|
1610
|
+
} : r[i] = (...p) => {
|
|
1611
|
+
if (this.defaults.async) return (async () => {
|
|
1612
|
+
let d = await u.apply(r, p);
|
|
1613
|
+
return d === !1 && (d = await a.apply(r, p)), d;
|
|
1614
|
+
})();
|
|
1615
|
+
let c = u.apply(r, p);
|
|
1616
|
+
return c === !1 && (c = a.apply(r, p)), c;
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
s.hooks = r;
|
|
1620
|
+
}
|
|
1621
|
+
if (n.walkTokens) {
|
|
1622
|
+
let r = this.defaults.walkTokens, o = n.walkTokens;
|
|
1623
|
+
s.walkTokens = function(i) {
|
|
1624
|
+
let u = [];
|
|
1625
|
+
return u.push(o.call(this, i)), r && (u = u.concat(r.call(this, i))), u;
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
this.defaults = {
|
|
1629
|
+
...this.defaults,
|
|
1630
|
+
...s
|
|
1631
|
+
};
|
|
1632
|
+
}), this;
|
|
1633
|
+
}
|
|
1634
|
+
setOptions(e) {
|
|
1635
|
+
return this.defaults = {
|
|
1636
|
+
...this.defaults,
|
|
1637
|
+
...e
|
|
1638
|
+
}, this;
|
|
1639
|
+
}
|
|
1640
|
+
lexer(e, t) {
|
|
1641
|
+
return R.lex(e, t ?? this.defaults);
|
|
1642
|
+
}
|
|
1643
|
+
parser(e, t) {
|
|
1644
|
+
return T.parse(e, t ?? this.defaults);
|
|
1645
|
+
}
|
|
1646
|
+
parseMarkdown(e) {
|
|
1647
|
+
return (n, s) => {
|
|
1648
|
+
let r = { ...s }, o = {
|
|
1649
|
+
...this.defaults,
|
|
1650
|
+
...r
|
|
1651
|
+
}, i = this.onError(!!o.silent, !!o.async);
|
|
1652
|
+
if (this.defaults.async === !0 && r.async === !1) return i(/* @__PURE__ */ new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1653
|
+
if (typeof n > "u" || n === null) return i(/* @__PURE__ */ new Error("marked(): input parameter is undefined or null"));
|
|
1654
|
+
if (typeof n != "string") return i(/* @__PURE__ */ new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1655
|
+
if (o.hooks && (o.hooks.options = o, o.hooks.block = e), o.async) return (async () => {
|
|
1656
|
+
let u = o.hooks ? await o.hooks.preprocess(n) : n, p = await (o.hooks ? await o.hooks.provideLexer(e) : e ? R.lex : R.lexInline)(u, o), c = o.hooks ? await o.hooks.processAllTokens(p) : p;
|
|
1657
|
+
o.walkTokens && await Promise.all(this.walkTokens(c, o.walkTokens));
|
|
1658
|
+
let m = await (o.hooks ? await o.hooks.provideParser(e) : e ? T.parse : T.parseInline)(c, o);
|
|
1659
|
+
return o.hooks ? await o.hooks.postprocess(m) : m;
|
|
1660
|
+
})().catch(i);
|
|
1661
|
+
try {
|
|
1662
|
+
o.hooks && (n = o.hooks.preprocess(n));
|
|
1663
|
+
let a = (o.hooks ? o.hooks.provideLexer(e) : e ? R.lex : R.lexInline)(n, o);
|
|
1664
|
+
o.hooks && (a = o.hooks.processAllTokens(a)), o.walkTokens && this.walkTokens(a, o.walkTokens);
|
|
1665
|
+
let c = (o.hooks ? o.hooks.provideParser(e) : e ? T.parse : T.parseInline)(a, o);
|
|
1666
|
+
return o.hooks && (c = o.hooks.postprocess(c)), c;
|
|
1667
|
+
} catch (u) {
|
|
1668
|
+
return i(u);
|
|
1669
|
+
}
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
onError(e, t) {
|
|
1673
|
+
return (n) => {
|
|
1674
|
+
if (n.message += `
|
|
1675
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1676
|
+
let s = "<p>An error occurred:</p><pre>" + O(n.message + "", !0) + "</pre>";
|
|
1677
|
+
return t ? Promise.resolve(s) : s;
|
|
1678
|
+
}
|
|
1679
|
+
if (t) return Promise.reject(n);
|
|
1680
|
+
throw n;
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
var E = new F();
|
|
1685
|
+
function k(l, e) {
|
|
1686
|
+
return E.parse(l, e);
|
|
1687
|
+
}
|
|
1688
|
+
k.options = k.setOptions = function(l) {
|
|
1689
|
+
return E.setOptions(l), k.defaults = E.defaults, W(k.defaults), k;
|
|
1690
|
+
};
|
|
1691
|
+
k.getDefaults = I;
|
|
1692
|
+
k.defaults = P;
|
|
1693
|
+
function yt(...l) {
|
|
1694
|
+
return E.use(...l), k.defaults = E.defaults, W(k.defaults), k;
|
|
1695
|
+
}
|
|
1696
|
+
k.use = yt;
|
|
1697
|
+
k.walkTokens = function(l, e) {
|
|
1698
|
+
return E.walkTokens(l, e);
|
|
1699
|
+
};
|
|
1700
|
+
k.parseInline = E.parseInline;
|
|
1701
|
+
k.Parser = T;
|
|
1702
|
+
k.parser = T.parse;
|
|
1703
|
+
k.Renderer = S;
|
|
1704
|
+
k.TextRenderer = z;
|
|
1705
|
+
k.Lexer = R;
|
|
1706
|
+
k.lexer = R.lex;
|
|
1707
|
+
k.Tokenizer = y;
|
|
1708
|
+
k.Hooks = _;
|
|
1709
|
+
k.parse = k;
|
|
1710
|
+
k.options;
|
|
1711
|
+
k.setOptions;
|
|
1712
|
+
k.walkTokens;
|
|
1713
|
+
k.parseInline;
|
|
1714
|
+
T.parse;
|
|
1715
|
+
R.lex;
|
|
1716
|
+
//#endregion
|
|
1717
|
+
//#region spec-tools/src/html.ts
|
|
1718
|
+
/**
|
|
1719
|
+
* `spec-tools html <file.md>...`: GitHub-flavoured Markdown to a fully self-contained HTML file next to each — the
|
|
1720
|
+
* GitHub stylesheet (light and dark) inlined, so a report opens straight from CI artifacts with no external reference.
|
|
1721
|
+
* A missing file is skipped.
|
|
1722
|
+
*/
|
|
1723
|
+
const escape = (s) => s.replace(/[&<>]/g, (c) => ({
|
|
1724
|
+
"&": "&",
|
|
1725
|
+
"<": "<",
|
|
1726
|
+
">": ">"
|
|
1727
|
+
})[c]);
|
|
1728
|
+
/** One Markdown document as a standalone page. */
|
|
1729
|
+
const page = (title, markdown) => `<!doctype html>
|
|
1730
|
+
<html lang="en">
|
|
1731
|
+
<head>
|
|
1732
|
+
<meta charset="utf-8">
|
|
1733
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1734
|
+
<title>${escape(title)}</title>
|
|
1735
|
+
<style>
|
|
1736
|
+
${github_markdown_default}
|
|
1737
|
+
.markdown-body { box-sizing: border-box; max-width: 980px; margin: 0 auto; padding: 2rem 3rem; }
|
|
1738
|
+
@media (max-width: 767px) { .markdown-body { padding: 1rem; } }
|
|
1739
|
+
</style>
|
|
1740
|
+
</head>
|
|
1741
|
+
<body class="markdown-body">
|
|
1742
|
+
${k.parse(markdown, {
|
|
1743
|
+
gfm: true,
|
|
1744
|
+
async: false
|
|
1745
|
+
})}
|
|
1746
|
+
</body>
|
|
1747
|
+
</html>
|
|
1748
|
+
`;
|
|
1749
|
+
function html(files) {
|
|
1750
|
+
if (!files.length) {
|
|
1751
|
+
console.error("usage: spec-tools html <file.md> [more.md ...]");
|
|
1752
|
+
return 2;
|
|
1753
|
+
}
|
|
1754
|
+
for (const file of files) {
|
|
1755
|
+
if (!fs.existsSync(file)) {
|
|
1756
|
+
console.warn(`skip (not found): ${file}`);
|
|
1757
|
+
continue;
|
|
1758
|
+
}
|
|
1759
|
+
const out = file.replace(/\.md$/i, ".html");
|
|
1760
|
+
fs.writeFileSync(out, page(path.basename(file, path.extname(file)), fs.readFileSync(file, "utf8")));
|
|
1761
|
+
console.log(`wrote ${out}`);
|
|
1762
|
+
}
|
|
1763
|
+
return 0;
|
|
1764
|
+
}
|
|
1765
|
+
//#endregion
|
|
1766
|
+
export { html };
|