@notectl/core 2.2.6 → 2.3.3
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 +1 -1
- package/THIRD-PARTY-NOTICES.md +129 -0
- package/dist/chunks/{AlignmentPlugin-DeD4C4EP.mjs → AlignmentPlugin-C9Rr_R-g.mjs} +2 -2
- package/dist/chunks/{AlignmentPlugin-DeD4C4EP.mjs.map → AlignmentPlugin-C9Rr_R-g.mjs.map} +1 -1
- package/dist/chunks/{AttrRegistry-DcDVyzLm.mjs → AttrRegistry-B3zB02z9.mjs} +2 -2
- package/dist/chunks/AttrRegistry-B3zB02z9.mjs.map +1 -0
- package/dist/chunks/AttributedMarkCommands-BCvmqeFZ.mjs +2 -0
- package/dist/chunks/{AttributedMarkCommands-D4W2Jgpj.mjs.map → AttributedMarkCommands-BCvmqeFZ.mjs.map} +1 -1
- package/dist/chunks/{BidiIsolationPlugin-BddRbDCN.mjs → BidiIsolationPlugin-Cw2KMk-H.mjs} +2 -2
- package/dist/chunks/{BidiIsolationPlugin-BddRbDCN.mjs.map → BidiIsolationPlugin-Cw2KMk-H.mjs.map} +1 -1
- package/dist/chunks/BlockInsertion-CYH2gRkY.mjs +2 -0
- package/dist/chunks/BlockInsertion-CYH2gRkY.mjs.map +1 -0
- package/dist/chunks/BlockquotePlugin-0bZSbkyo.mjs +2 -0
- package/dist/chunks/{BlockquotePlugin-4V7KV_Sb.mjs.map → BlockquotePlugin-0bZSbkyo.mjs.map} +1 -1
- package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs +2 -0
- package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs.map +1 -0
- package/dist/chunks/CodeBlockPlugin-BCJ3faXx.mjs +2 -0
- package/dist/chunks/CodeBlockPlugin-BCJ3faXx.mjs.map +1 -0
- package/dist/chunks/{ColorGrid-DPNiXxpD.mjs → ColorGrid-DQEkJ-0y.mjs} +2 -2
- package/dist/chunks/{ColorGrid-DPNiXxpD.mjs.map → ColorGrid-DQEkJ-0y.mjs.map} +1 -1
- package/dist/chunks/{ColorPickerPopup-lcf3jS6G.mjs → ColorPickerPopup-CyF26zIU.mjs} +2 -2
- package/dist/chunks/{ColorPickerPopup-lcf3jS6G.mjs.map → ColorPickerPopup-CyF26zIU.mjs.map} +1 -1
- package/dist/chunks/Commands-D5ND50PQ.mjs +2 -0
- package/dist/chunks/Commands-D5ND50PQ.mjs.map +1 -0
- package/dist/chunks/ContentModel-NpAj7vGW.mjs +2 -0
- package/dist/chunks/ContentModel-NpAj7vGW.mjs.map +1 -0
- package/dist/chunks/Decoration-BOP1TAUd.mjs +2 -0
- package/dist/chunks/Decoration-BOP1TAUd.mjs.map +1 -0
- package/dist/chunks/{DirectionDetection-C7XE0nxW.mjs → DirectionDetection-CDVSEWQ6.mjs} +2 -2
- package/dist/chunks/{DirectionDetection-C7XE0nxW.mjs.map → DirectionDetection-CDVSEWQ6.mjs.map} +1 -1
- package/dist/chunks/Document-827l3P80.mjs +2 -0
- package/dist/chunks/Document-827l3P80.mjs.map +1 -0
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs +2 -0
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs.map +1 -0
- package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs +2 -0
- package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -0
- package/dist/chunks/{FontPlugin-DQMj65Bc.mjs → FontPlugin-D041tiLe.mjs} +2 -2
- package/dist/chunks/{FontPlugin-DQMj65Bc.mjs.map → FontPlugin-D041tiLe.mjs.map} +1 -1
- package/dist/chunks/{FontSizePlugin-9StCjEfN.mjs → FontSizePlugin-8CAvj1RD.mjs} +2 -2
- package/dist/chunks/FontSizePlugin-8CAvj1RD.mjs.map +1 -0
- package/dist/chunks/FormulaPlugin-DJ39BtqV.mjs +2 -0
- package/dist/chunks/FormulaPlugin-DJ39BtqV.mjs.map +1 -0
- package/dist/chunks/GapCursorNavigation-DCWOmopl.mjs +2 -0
- package/dist/chunks/{GapCursorNavigation-ycNzuQVH.mjs.map → GapCursorNavigation-DCWOmopl.mjs.map} +1 -1
- package/dist/chunks/GapCursorPlugin-2iR6506y.mjs +2 -0
- package/dist/chunks/{GapCursorPlugin-Zvxjnr82.mjs.map → GapCursorPlugin-2iR6506y.mjs.map} +1 -1
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs +2 -0
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs.map +1 -0
- package/dist/chunks/{HardBreakPlugin-9DOyCyyM.mjs → HardBreakPlugin-vniSvTgq.mjs} +2 -2
- package/dist/chunks/{HardBreakPlugin-9DOyCyyM.mjs.map → HardBreakPlugin-vniSvTgq.mjs.map} +1 -1
- package/dist/chunks/HeadingPlugin-DUKsLuMd.mjs +2 -0
- package/dist/chunks/{HeadingPlugin-BuGoM9Rz.mjs.map → HeadingPlugin-DUKsLuMd.mjs.map} +1 -1
- package/dist/chunks/{HighlightPlugin-C6pHifVz.mjs → HighlightPlugin-DRTAE1N5.mjs} +2 -2
- package/dist/chunks/{HighlightPlugin-C6pHifVz.mjs.map → HighlightPlugin-DRTAE1N5.mjs.map} +1 -1
- package/dist/chunks/HorizontalRulePlugin-B9OvwrKB.mjs +2 -0
- package/dist/chunks/HorizontalRulePlugin-B9OvwrKB.mjs.map +1 -0
- package/dist/chunks/ImagePlugin-CwxTRr6d.mjs +2 -0
- package/dist/chunks/{ImagePlugin-KpkuE2LH.mjs.map → ImagePlugin-CwxTRr6d.mjs.map} +1 -1
- package/dist/chunks/{InlineCodePlugin-DMr4O7c7.mjs → InlineCodePlugin-uxgMUX_E.mjs} +2 -2
- package/dist/chunks/InlineCodePlugin-uxgMUX_E.mjs.map +1 -0
- package/dist/chunks/InlineStyleMarkSpec-CjSRj4f_.mjs +2 -0
- package/dist/chunks/{InlineStyleMarkSpec-C6LJT7kp.mjs.map → InlineStyleMarkSpec-CjSRj4f_.mjs.map} +1 -1
- package/dist/chunks/LinkPlugin-CvWHbSkb.mjs +2 -0
- package/dist/chunks/LinkPlugin-CvWHbSkb.mjs.map +1 -0
- package/dist/chunks/ListPlugin-BchSFWVn.mjs +2 -0
- package/dist/chunks/ListPlugin-BchSFWVn.mjs.map +1 -0
- package/dist/chunks/MarkInputRule-Bdi8KPus.mjs +2 -0
- package/dist/chunks/MarkInputRule-Bdi8KPus.mjs.map +1 -0
- package/dist/chunks/MarkdownHTMLRegistry-Q7l0d6Ma.mjs +2 -0
- package/dist/chunks/MarkdownHTMLRegistry-Q7l0d6Ma.mjs.map +1 -0
- package/dist/chunks/MarkdownParser-Dp62mfUq.mjs +2 -0
- package/dist/chunks/MarkdownParser-Dp62mfUq.mjs.map +1 -0
- package/dist/chunks/MarkdownSerializer-DBELFAeo.mjs +2 -0
- package/dist/chunks/MarkdownSerializer-DBELFAeo.mjs.map +1 -0
- package/dist/chunks/MathFont-BS8IwYh2.mjs +2 -0
- package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -0
- package/dist/chunks/{NodeResolver-ChgLF_IP.mjs → NodeResolver-Dleih-8R.mjs} +2 -2
- package/dist/chunks/{NodeResolver-ChgLF_IP.mjs.map → NodeResolver-Dleih-8R.mjs.map} +1 -1
- package/dist/chunks/NodeSelectionCommands-WH5snxr_.mjs +2 -0
- package/dist/chunks/{NodeSelectionCommands-Dj4VxLdD.mjs.map → NodeSelectionCommands-WH5snxr_.mjs.map} +1 -1
- package/dist/chunks/{PopupManager-DUtaK3WX.mjs → PopupManager-Cj86uDEB.mjs} +2 -2
- package/dist/chunks/{PopupManager-DUtaK3WX.mjs.map → PopupManager-Cj86uDEB.mjs.map} +1 -1
- package/dist/chunks/PopupPositioning-BFh6Ed1D.mjs +2 -0
- package/dist/chunks/{PopupPositioning-BB97-__N.mjs.map → PopupPositioning-BFh6Ed1D.mjs.map} +1 -1
- package/dist/chunks/PrintPlugin-D2javl_d.mjs +2 -0
- package/dist/chunks/PrintPlugin-D2javl_d.mjs.map +1 -0
- package/dist/chunks/{RangeIterator-o8v3msQe.mjs → RangeIterator-DP7Ud3Gp.mjs} +2 -2
- package/dist/chunks/{RangeIterator-o8v3msQe.mjs.map → RangeIterator-DP7Ud3Gp.mjs.map} +1 -1
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs +2 -0
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs.map +1 -0
- package/dist/chunks/SimpleMark-gTQaSJcO.mjs +2 -0
- package/dist/chunks/{SimpleMark-CaQtFAau.mjs.map → SimpleMark-gTQaSJcO.mjs.map} +1 -1
- package/dist/chunks/SmartPastePlugin-BvJQ-fOz.mjs +2 -0
- package/dist/chunks/SmartPastePlugin-BvJQ-fOz.mjs.map +1 -0
- package/dist/chunks/StarterFonts-BDQPg-cu.mjs +2 -0
- package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -0
- package/dist/chunks/StrikethroughPlugin-BdrG1TTY.mjs +2 -0
- package/dist/chunks/StrikethroughPlugin-BdrG1TTY.mjs.map +1 -0
- package/dist/chunks/StyleRuntime-DW6omotc.mjs +2 -0
- package/dist/chunks/StyleRuntime-DW6omotc.mjs.map +1 -0
- package/dist/chunks/{SuperSubPlugin-DVP7VnIz.mjs → SuperSubPlugin-DTZB0Y3D.mjs} +2 -2
- package/dist/chunks/{SuperSubPlugin-DVP7VnIz.mjs.map → SuperSubPlugin-DTZB0Y3D.mjs.map} +1 -1
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs +2 -0
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs.map +1 -0
- package/dist/chunks/TablePlugin-CPvg9YZS.mjs +2 -0
- package/dist/chunks/TablePlugin-CPvg9YZS.mjs.map +1 -0
- package/dist/chunks/TextColorPlugin-Ckg3KWvb.mjs +2 -0
- package/dist/chunks/{TextColorPlugin-CEfZQ6Md.mjs.map → TextColorPlugin-Ckg3KWvb.mjs.map} +1 -1
- package/dist/chunks/TextDirectionAutoPlugin-DRGbgTlx.mjs +2 -0
- package/dist/chunks/{TextDirectionAutoPlugin-CzWJjrvG.mjs.map → TextDirectionAutoPlugin-DRGbgTlx.mjs.map} +1 -1
- package/dist/chunks/TextDirectionPlugin-BCeYyJHo.mjs +2 -0
- package/dist/chunks/{TextDirectionPlugin-DHB88HKf.mjs.map → TextDirectionPlugin-BCeYyJHo.mjs.map} +1 -1
- package/dist/chunks/TextFormattingPlugin-BhRxSC8q.mjs +2 -0
- package/dist/chunks/TextFormattingPlugin-BhRxSC8q.mjs.map +1 -0
- package/dist/chunks/ThemeEngine-BUVo_zaT.mjs +3 -0
- package/dist/chunks/ThemeEngine-BUVo_zaT.mjs.map +1 -0
- package/dist/chunks/ToolbarPlugin-dmTj1jIz.mjs +2 -0
- package/dist/chunks/{ToolbarPlugin-DVGrFf8v.mjs.map → ToolbarPlugin-dmTj1jIz.mjs.map} +1 -1
- package/dist/chunks/VideoPlugin-BugkI7-m.mjs +2 -0
- package/dist/chunks/VideoPlugin-BugkI7-m.mjs.map +1 -0
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs +2 -0
- package/dist/chunks/{WordBoundary-DxeMBRyP.mjs.map → WordBoundary-CFpIJDNP.mjs.map} +1 -1
- package/dist/chunks/XmlSupport-DIXH5on9.mjs +2 -0
- package/dist/chunks/XmlSupport-DIXH5on9.mjs.map +1 -0
- package/dist/chunks/ar-Dg9PdDet.mjs +2 -0
- package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -0
- package/dist/chunks/ar-eOA3UmiE.mjs +2 -0
- package/dist/chunks/{ar-BTShmP2E.mjs.map → ar-eOA3UmiE.mjs.map} +1 -1
- package/dist/chunks/de-DJ5EkXQo.mjs +2 -0
- package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -0
- package/dist/chunks/{de-C--bRmjW.mjs → de-DRbhnS4T.mjs} +2 -2
- package/dist/chunks/{de-C--bRmjW.mjs.map → de-DRbhnS4T.mjs.map} +1 -1
- package/dist/chunks/{es-DFUVd7eO.mjs → es-BQ9dox_E.mjs} +2 -2
- package/dist/chunks/{es-DFUVd7eO.mjs.map → es-BQ9dox_E.mjs.map} +1 -1
- package/dist/chunks/es-CEAJj7aB.mjs +2 -0
- package/dist/chunks/es-CEAJj7aB.mjs.map +1 -0
- package/dist/chunks/fr-DhWQzZy3.mjs +2 -0
- package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -0
- package/dist/chunks/{fr-BaXKyPmX.mjs → fr-NVOinLyF.mjs} +2 -2
- package/dist/chunks/{fr-BaXKyPmX.mjs.map → fr-NVOinLyF.mjs.map} +1 -1
- package/dist/chunks/full-JM0-SwWy.mjs +2 -0
- package/dist/chunks/{full-BBl7mvwH.mjs.map → full-JM0-SwWy.mjs.map} +1 -1
- package/dist/chunks/hi-BsZzSMfL.mjs +2 -0
- package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -0
- package/dist/chunks/{hi-aH9HZG23.mjs → hi-DrC2H81d.mjs} +2 -2
- package/dist/chunks/{hi-aH9HZG23.mjs.map → hi-DrC2H81d.mjs.map} +1 -1
- package/dist/chunks/minimal-DSlR2A27.mjs +2 -0
- package/dist/chunks/{minimal-CtnR4dqp.mjs.map → minimal-DSlR2A27.mjs.map} +1 -1
- package/dist/chunks/pt-BuZ7acHF.mjs +2 -0
- package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -0
- package/dist/chunks/{pt-Hy-0Xnnc.mjs → pt-CFrcl1v_.mjs} +2 -2
- package/dist/chunks/{pt-Hy-0Xnnc.mjs.map → pt-CFrcl1v_.mjs.map} +1 -1
- package/dist/chunks/register-BjsdJ3Aq.mjs +2 -0
- package/dist/chunks/register-BjsdJ3Aq.mjs.map +1 -0
- package/dist/chunks/rolldown-runtime-H_PjY6_i.mjs +1 -0
- package/dist/chunks/ru-CsP6mLxp.mjs +2 -0
- package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -0
- package/dist/chunks/{ru-BFpEOrVp.mjs → ru-gxbzqLL8.mjs} +2 -2
- package/dist/chunks/{ru-BFpEOrVp.mjs.map → ru-gxbzqLL8.mjs.map} +1 -1
- package/dist/chunks/src-5GKFQ2mQ.mjs +2 -0
- package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -0
- package/dist/chunks/xml-BsV44TrJ.mjs +2 -0
- package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -0
- package/dist/chunks/zh-BFZOM3lF.mjs +2 -0
- package/dist/chunks/{zh-BjoyjClN.mjs.map → zh-BFZOM3lF.mjs.map} +1 -1
- package/dist/chunks/zh-CiIyOm6U.mjs +2 -0
- package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -0
- package/dist/commands/BlockInsertion.d.ts +5 -3
- package/dist/commands/BlockInsertion.d.ts.map +1 -1
- package/dist/commands/SelectionDeletion.d.ts +13 -2
- package/dist/commands/SelectionDeletion.d.ts.map +1 -1
- package/dist/editor/ContentSerializer.d.ts +21 -0
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/EditorConfig.d.ts +17 -0
- package/dist/editor/EditorConfig.d.ts.map +1 -1
- package/dist/editor/EditorConfigController.d.ts +10 -0
- package/dist/editor/EditorConfigController.d.ts.map +1 -1
- package/dist/editor/EditorInitializer.d.ts +4 -0
- package/dist/editor/EditorInitializer.d.ts.map +1 -1
- package/dist/editor/EditorLocale.d.ts +2 -0
- package/dist/editor/EditorLocale.d.ts.map +1 -1
- package/dist/editor/MarkdownMode.d.ts +46 -0
- package/dist/editor/MarkdownMode.d.ts.map +1 -0
- package/dist/editor/NotectlEditor.d.ts +24 -0
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/locales/ar.d.ts.map +1 -1
- package/dist/editor/locales/de.d.ts.map +1 -1
- package/dist/editor/locales/es.d.ts.map +1 -1
- package/dist/editor/locales/fr.d.ts.map +1 -1
- package/dist/editor/locales/hi.d.ts.map +1 -1
- package/dist/editor/locales/pt.d.ts.map +1 -1
- package/dist/editor/locales/ru.d.ts.map +1 -1
- package/dist/editor/locales/zh.d.ts.map +1 -1
- package/dist/editor/styles/list.d.ts +1 -1
- package/dist/editor/styles/list.d.ts.map +1 -1
- package/dist/editor/styles/table.d.ts +1 -1
- package/dist/editor/styles/table.d.ts.map +1 -1
- package/dist/fonts/math.d.ts +3 -0
- package/dist/fonts/math.d.ts.map +1 -0
- package/dist/fonts/math.mjs +1 -0
- package/dist/fonts/starter.d.ts +3 -0
- package/dist/fonts/starter.d.ts.map +1 -0
- package/dist/fonts/starter.mjs +1 -0
- package/dist/fonts.d.ts +4 -4
- package/dist/fonts.mjs +1 -1
- package/dist/full.d.ts +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.d.ts +1 -0
- package/dist/html.d.ts.map +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/input/ClipboardHandler.d.ts +2 -0
- package/dist/input/ClipboardHandler.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +7 -0
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +10 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/MarkdownPasteDetector.d.ts +26 -0
- package/dist/input/MarkdownPasteDetector.d.ts.map +1 -0
- package/dist/input/PasteHTMLHandler.d.ts +18 -1
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts +30 -0
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/input/SelectionDocument.d.ts +2 -1
- package/dist/input/SelectionDocument.d.ts.map +1 -1
- package/dist/markdown.d.ts +17 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.mjs +1 -0
- package/dist/model/AttrRegistry.d.ts +2 -2
- package/dist/model/AttrRegistry.d.ts.map +1 -1
- package/dist/model/ContentModel.d.ts +12 -0
- package/dist/model/ContentModel.d.ts.map +1 -1
- package/dist/model/Document.d.ts +28 -3
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/HTMLUtils.d.ts +15 -0
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/model/InlineNodeSpec.d.ts +7 -1
- package/dist/model/InlineNodeSpec.d.ts.map +1 -1
- package/dist/model/InputRule.d.ts +11 -0
- package/dist/model/InputRule.d.ts.map +1 -1
- package/dist/model/MarkSpec.d.ts +7 -1
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/model/MarkdownSyntaxRegistry.d.ts +51 -0
- package/dist/model/MarkdownSyntaxRegistry.d.ts.map +1 -0
- package/dist/model/NodeSpec.d.ts +47 -1
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/model/RichBlockData.d.ts +2 -0
- package/dist/model/RichBlockData.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/TableDimensions.d.ts +11 -0
- package/dist/model/TableDimensions.d.ts.map +1 -0
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/platform/EditorEventBoundary.d.ts +12 -0
- package/dist/platform/EditorEventBoundary.d.ts.map +1 -0
- package/dist/plugins/Plugin.d.ts +7 -0
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +2 -0
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +2 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/bidi-isolation.mjs +1 -1
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts +2 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockHighlighting.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockTypes.d.ts +2 -0
- package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/DisplayMathNodeSpec.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaInputRules.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaMarkdownSyntax.d.ts +4 -0
- package/dist/plugins/formula/FormulaMarkdownSyntax.d.ts.map +1 -0
- package/dist/plugins/formula/FormulaPlugin.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaTypes.d.ts +3 -1
- package/dist/plugins/formula/FormulaTypes.d.ts.map +1 -1
- package/dist/plugins/formula/InlineMathNodeSpec.d.ts.map +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/gap-cursor.mjs +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading/HeadingPlugin.d.ts +2 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +2 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts +14 -0
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/inline-code/InlineCodePlugin.d.ts.map +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/language.mjs +1 -1
- package/dist/plugins/link/LinkPlugin.d.ts +14 -0
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListCommands.d.ts +5 -1
- package/dist/plugins/list/ListCommands.d.ts.map +1 -1
- package/dist/plugins/list/ListInputRules.d.ts.map +1 -1
- package/dist/plugins/list/ListItemContext.d.ts +27 -0
- package/dist/plugins/list/ListItemContext.d.ts.map +1 -0
- package/dist/plugins/list/ListKeyboardHandlers.d.ts.map +1 -1
- package/dist/plugins/list/ListPlugin.d.ts +2 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list/ListToolbarItems.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -1
- package/dist/plugins/print/PrintDestinationBridge.d.ts +23 -0
- package/dist/plugins/print/PrintDestinationBridge.d.ts.map +1 -0
- package/dist/plugins/print/PrintHostStyles.d.ts.map +1 -1
- package/dist/plugins/print/PrintServiceImpl.d.ts +5 -1
- package/dist/plugins/print/PrintServiceImpl.d.ts.map +1 -1
- package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/MarkInputRule.d.ts +9 -0
- package/dist/plugins/shared/MarkInputRule.d.ts.map +1 -0
- package/dist/plugins/shared/PopupPositioning.d.ts +2 -0
- package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
- package/dist/plugins/shared/index.d.ts +1 -0
- package/dist/plugins/shared/index.d.ts.map +1 -1
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
- package/dist/plugins/smart-paste.mjs +1 -1
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +2 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/table/TableClipboard.d.ts +8 -0
- package/dist/plugins/table/TableClipboard.d.ts.map +1 -0
- package/dist/plugins/table/TableCommands.d.ts.map +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts +11 -1
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
- package/dist/plugins/table/TableControls.d.ts +6 -1
- package/dist/plugins/table/TableControls.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts +11 -2
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsLayout.d.ts +12 -3
- package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -1
- package/dist/plugins/table/TableGrid.d.ts +57 -0
- package/dist/plugins/table/TableGrid.d.ts.map +1 -0
- package/dist/plugins/table/TableHelpers.d.ts +4 -0
- package/dist/plugins/table/TableHelpers.d.ts.map +1 -1
- package/dist/plugins/table/TableLocale.d.ts +30 -0
- package/dist/plugins/table/TableLocale.d.ts.map +1 -1
- package/dist/plugins/table/TableNavigation.d.ts +5 -1
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
- package/dist/plugins/table/TableNodeViews.d.ts +13 -1
- package/dist/plugins/table/TableNodeViews.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts +21 -1
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
- package/dist/plugins/table/TableSelection.d.ts.map +1 -1
- package/dist/plugins/table/TableSizeEditor.d.ts +11 -0
- package/dist/plugins/table/TableSizeEditor.d.ts.map +1 -0
- package/dist/plugins/table/TableSizing.d.ts +70 -0
- package/dist/plugins/table/TableSizing.d.ts.map +1 -0
- package/dist/plugins/table/index.d.ts +3 -1
- package/dist/plugins/table/index.d.ts.map +1 -1
- package/dist/plugins/table/locales/ar.d.ts.map +1 -1
- package/dist/plugins/table/locales/de.d.ts.map +1 -1
- package/dist/plugins/table/locales/es.d.ts.map +1 -1
- package/dist/plugins/table/locales/fr.d.ts.map +1 -1
- package/dist/plugins/table/locales/hi.d.ts.map +1 -1
- package/dist/plugins/table/locales/pt.d.ts.map +1 -1
- package/dist/plugins/table/locales/ru.d.ts.map +1 -1
- package/dist/plugins/table/locales/zh.d.ts.map +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-direction-auto.mjs +1 -1
- package/dist/plugins/text-direction.mjs +1 -1
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +9 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/video/VideoCommands.d.ts.map +1 -1
- package/dist/plugins/video.mjs +1 -1
- package/dist/presets/full.d.ts +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.d.ts +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/register.d.ts +3 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.mjs +1 -0
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts +2 -0
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/HTMLSanitization.d.ts +15 -0
- package/dist/serialization/HTMLSanitization.d.ts.map +1 -0
- package/dist/serialization/MarkSerializer.d.ts +12 -0
- package/dist/serialization/MarkSerializer.d.ts.map +1 -1
- package/dist/serialization/MarkdownParser.d.ts +6 -0
- package/dist/serialization/MarkdownParser.d.ts.map +1 -0
- package/dist/serialization/MarkdownSerializer.d.ts +12 -0
- package/dist/serialization/MarkdownSerializer.d.ts.map +1 -0
- package/dist/serialization/MarkdownTypes.d.ts +59 -0
- package/dist/serialization/MarkdownTypes.d.ts.map +1 -0
- package/dist/serialization/TableDimensions.d.ts +37 -0
- package/dist/serialization/TableDimensions.d.ts.map +1 -0
- package/dist/serialization/markdown/BlockSerializers.d.ts +7 -0
- package/dist/serialization/markdown/BlockSerializers.d.ts.map +1 -0
- package/dist/serialization/markdown/BlockTokenizer.d.ts +54 -0
- package/dist/serialization/markdown/BlockTokenizer.d.ts.map +1 -0
- package/dist/serialization/markdown/GfmAutolink.d.ts +20 -0
- package/dist/serialization/markdown/GfmAutolink.d.ts.map +1 -0
- package/dist/serialization/markdown/GfmTableParser.d.ts +26 -0
- package/dist/serialization/markdown/GfmTableParser.d.ts.map +1 -0
- package/dist/serialization/markdown/InlineAst.d.ts +34 -0
- package/dist/serialization/markdown/InlineAst.d.ts.map +1 -0
- package/dist/serialization/markdown/InlineSerializers.d.ts +5 -0
- package/dist/serialization/markdown/InlineSerializers.d.ts.map +1 -0
- package/dist/serialization/markdown/InlineTokenizer.d.ts +5 -0
- package/dist/serialization/markdown/InlineTokenizer.d.ts.map +1 -0
- package/dist/serialization/markdown/LinkReferenceExtractor.d.ts +37 -0
- package/dist/serialization/markdown/LinkReferenceExtractor.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownContext.d.ts +32 -0
- package/dist/serialization/markdown/MarkdownContext.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownEntities.d.ts +33 -0
- package/dist/serialization/markdown/MarkdownEntities.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownEscape.d.ts +33 -0
- package/dist/serialization/markdown/MarkdownEscape.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownHTMLRegistry.d.ts +4 -0
- package/dist/serialization/markdown/MarkdownHTMLRegistry.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownParseContext.d.ts +23 -0
- package/dist/serialization/markdown/MarkdownParseContext.d.ts.map +1 -0
- package/dist/state/Mapping.d.ts +33 -10
- package/dist/state/Mapping.d.ts.map +1 -1
- package/dist/state/StepApplication.d.ts +3 -1
- package/dist/state/StepApplication.d.ts.map +1 -1
- package/dist/state/StepHandlers.d.ts.map +1 -1
- package/dist/state/StepInversion.d.ts +2 -1
- package/dist/state/StepInversion.d.ts.map +1 -1
- package/dist/state/StepMapping.d.ts +3 -2
- package/dist/state/StepMapping.d.ts.map +1 -1
- package/dist/state/StepMaps.d.ts +3 -2
- package/dist/state/StepMaps.d.ts.map +1 -1
- package/dist/state/Steps.d.ts +34 -2
- package/dist/state/Steps.d.ts.map +1 -1
- package/dist/state/TransactionBuilder.d.ts +7 -1
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/test/MarkdownConformanceUtils.d.ts +12 -0
- package/dist/test/MarkdownConformanceUtils.d.ts.map +1 -0
- package/dist/view/BlockRendering.d.ts +5 -0
- package/dist/view/BlockRendering.d.ts.map +1 -1
- package/dist/view/DecorationRendering.d.ts +6 -0
- package/dist/view/DecorationRendering.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts.map +1 -1
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +28 -214
- package/dist/chunks/AttrRegistry-DcDVyzLm.mjs.map +0 -1
- package/dist/chunks/AttributedMarkCommands-D4W2Jgpj.mjs +0 -2
- package/dist/chunks/BlockInsertion-6rR9tIGP.mjs +0 -2
- package/dist/chunks/BlockInsertion-6rR9tIGP.mjs.map +0 -1
- package/dist/chunks/BlockquotePlugin-4V7KV_Sb.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-C6XBwp0N.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-C6XBwp0N.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-3V2K3RBe.mjs +0 -2
- package/dist/chunks/CodeBlockPlugin-3V2K3RBe.mjs.map +0 -1
- package/dist/chunks/Commands-BIIpx_Zd.mjs +0 -2
- package/dist/chunks/Commands-BIIpx_Zd.mjs.map +0 -1
- package/dist/chunks/Decoration-ZeyVfwJB.mjs +0 -2
- package/dist/chunks/Decoration-ZeyVfwJB.mjs.map +0 -1
- package/dist/chunks/Document-r7vLOAGA.mjs +0 -2
- package/dist/chunks/Document-r7vLOAGA.mjs.map +0 -1
- package/dist/chunks/DocumentParser-CcTSeT1B.mjs +0 -2
- package/dist/chunks/DocumentParser-CcTSeT1B.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-9StCjEfN.mjs.map +0 -1
- package/dist/chunks/FormulaPlugin-CV5VUxkb.mjs +0 -2
- package/dist/chunks/FormulaPlugin-CV5VUxkb.mjs.map +0 -1
- package/dist/chunks/GapCursorNavigation-ycNzuQVH.mjs +0 -2
- package/dist/chunks/GapCursorPlugin-Zvxjnr82.mjs +0 -2
- package/dist/chunks/HTMLUtils-C6B4UT00.mjs +0 -2
- package/dist/chunks/HTMLUtils-C6B4UT00.mjs.map +0 -1
- package/dist/chunks/HeadingPlugin-BuGoM9Rz.mjs +0 -2
- package/dist/chunks/HorizontalRulePlugin-0FjHPZuA.mjs +0 -2
- package/dist/chunks/HorizontalRulePlugin-0FjHPZuA.mjs.map +0 -1
- package/dist/chunks/ImagePlugin-KpkuE2LH.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-DMr4O7c7.mjs.map +0 -1
- package/dist/chunks/InlineStyleMarkSpec-C6LJT7kp.mjs +0 -2
- package/dist/chunks/LinkPlugin-DvZ3MPgL.mjs +0 -2
- package/dist/chunks/LinkPlugin-DvZ3MPgL.mjs.map +0 -1
- package/dist/chunks/ListPlugin-2yl6KiTK.mjs +0 -2
- package/dist/chunks/ListPlugin-2yl6KiTK.mjs.map +0 -1
- package/dist/chunks/NodeSelectionCommands-Dj4VxLdD.mjs +0 -2
- package/dist/chunks/PopupPositioning-BB97-__N.mjs +0 -2
- package/dist/chunks/PrintPlugin-DyIZDY3Q.mjs +0 -2
- package/dist/chunks/PrintPlugin-DyIZDY3Q.mjs.map +0 -1
- package/dist/chunks/PrintTypes-CxU69qu3.mjs +0 -3
- package/dist/chunks/PrintTypes-CxU69qu3.mjs.map +0 -1
- package/dist/chunks/SimpleMark-CaQtFAau.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-Bi_wpTCV.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-Bi_wpTCV.mjs.map +0 -1
- package/dist/chunks/StrikethroughPlugin-BLKDRWtf.mjs +0 -2
- package/dist/chunks/StrikethroughPlugin-BLKDRWtf.mjs.map +0 -1
- package/dist/chunks/StyleRuntime-BFKu52mS.mjs +0 -2
- package/dist/chunks/StyleRuntime-BFKu52mS.mjs.map +0 -1
- package/dist/chunks/TablePlugin-BTH9VRZq.mjs +0 -2
- package/dist/chunks/TablePlugin-BTH9VRZq.mjs.map +0 -1
- package/dist/chunks/TextColorPlugin-CEfZQ6Md.mjs +0 -2
- package/dist/chunks/TextDirectionAutoPlugin-CzWJjrvG.mjs +0 -2
- package/dist/chunks/TextDirectionPlugin-DHB88HKf.mjs +0 -2
- package/dist/chunks/TextFormattingPlugin-Cubp3e7f.mjs +0 -2
- package/dist/chunks/TextFormattingPlugin-Cubp3e7f.mjs.map +0 -1
- package/dist/chunks/ToolbarPlugin-DVGrFf8v.mjs +0 -2
- package/dist/chunks/VideoPlugin-B3uf1Dwp.mjs +0 -2
- package/dist/chunks/VideoPlugin-B3uf1Dwp.mjs.map +0 -1
- package/dist/chunks/WordBoundary-DxeMBRyP.mjs +0 -2
- package/dist/chunks/XmlDetector-D7TQpw-e.mjs +0 -2
- package/dist/chunks/XmlDetector-D7TQpw-e.mjs.map +0 -1
- package/dist/chunks/XmlSupport-BYiRwlkK.mjs +0 -2
- package/dist/chunks/XmlSupport-BYiRwlkK.mjs.map +0 -1
- package/dist/chunks/ar-BTShmP2E.mjs +0 -2
- package/dist/chunks/ar-jbplYWkC.mjs +0 -2
- package/dist/chunks/ar-jbplYWkC.mjs.map +0 -1
- package/dist/chunks/de-DN-e6G5A.mjs +0 -2
- package/dist/chunks/de-DN-e6G5A.mjs.map +0 -1
- package/dist/chunks/es-CM55WeEN.mjs +0 -2
- package/dist/chunks/es-CM55WeEN.mjs.map +0 -1
- package/dist/chunks/fonts-DQC6Uj4r.mjs +0 -2
- package/dist/chunks/fonts-DQC6Uj4r.mjs.map +0 -1
- package/dist/chunks/fr-C_2i5Ono.mjs +0 -2
- package/dist/chunks/fr-C_2i5Ono.mjs.map +0 -1
- package/dist/chunks/full-BBl7mvwH.mjs +0 -2
- package/dist/chunks/hi-C9fvG91d.mjs +0 -2
- package/dist/chunks/hi-C9fvG91d.mjs.map +0 -1
- package/dist/chunks/minimal-CtnR4dqp.mjs +0 -2
- package/dist/chunks/pt-GqLw5tN0.mjs +0 -2
- package/dist/chunks/pt-GqLw5tN0.mjs.map +0 -1
- package/dist/chunks/ru-4g_qsaLr.mjs +0 -2
- package/dist/chunks/ru-4g_qsaLr.mjs.map +0 -1
- package/dist/chunks/src-C89Cw7ni.mjs +0 -2
- package/dist/chunks/src-C89Cw7ni.mjs.map +0 -1
- package/dist/chunks/zh-BjoyjClN.mjs +0 -2
- package/dist/chunks/zh-DeZP08HI.mjs +0 -2
- package/dist/chunks/zh-DeZP08HI.mjs.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{E as t,_ as e,f as n,o as i,p as s,u as c}from"./Document-827l3P80.mjs";import{d as r,o,t as l,u as a}from"./Selection-HYoVFpAx.mjs";import{a as d,t as u}from"./TypeBrands-Ch9856Gb.mjs";import{l as h}from"./BlockInsertion-CYH2gRkY.mjs";import{t as m}from"./RangeIterator-DP7Ud3Gp.mjs";import{r as p}from"./AttrRegistry-B3zB02z9.mjs";import{c as k,o as f}from"./PluginHelpers-KDuTlmXm.mjs";import{c as b}from"./StyleRuntime-DW6omotc.mjs";import{n as g}from"./DomUtils-Bf7JLFlx.mjs";function y(t,e,n){return"checklist"===t?{listType:t,indent:e,checked:n??!1}:{listType:t,indent:e}}function v(t,e){const n=t.getBlock(e);if("list_item"===n?.type)return n;const i=t.getNodePath(e);if(i)for(let s=i.length-2;s>=0;s--){const e=i[s],n=e?t.getBlock(e):void 0;if("list_item"===n?.type)return n}}function x(t,e){const n=t.getBlock(e);if(!n||"list_item"!==n.type)return;const i=t.getNodePath(e);if(!i)return;const c=i.slice(0,-1),r=c[c.length-1],o=(r?s(t.getBlock(r)):t.doc.children).findIndex(t=>t.id===e);return o<0?void 0:{item:n,parentPath:c,index:o}}function I(t,e){t.removeNode(e.parentPath,e.index),s(e.item).forEach((n,i)=>{t.insertNode(e.parentPath,e.index+i,n)})}function T(e,n){const i=e.getState(),s=i.selection;return!!a(s)&&(s.anchor.blockId!==s.head.blockId?function(e,n,i){const s=n.selection;if(!a(s))return!1;const c=r(s,n.getBlockOrder()),o=B(n,c,i),l=n.transaction("command"),u=function(t,e){const n=[],i=/* @__PURE__ */new Set;return m(t,e,e=>{const s=t.getBlock(e);if(!s)return;const c=v(t,e)??s;i.has(c.id)||(i.add(c.id),n.push(c))}),n}(n,c);for(let r=u.length-1;r>=0;r--){const e=u[r];if(e)if(o)if(t(e))l.setBlockType(e.id,d("paragraph"));else{const t=x(n,e.id);t&&I(l,t)}else{const t=p(e,"list_item")?e.attrs.indent:0,n=p(e,"list_item")&&"checklist"===e.attrs.listType&&e.attrs.checked;l.setBlockType(e.id,d("list_item"),y(i,t,n))}}return l.setSelection(s),e.dispatch(l.build()),!0}(e,i,n):function(e,n,i){const s=n.selection;if(!a(s))return!1;const c=n.getBlock(s.anchor.blockId);if(!c)return!1;const r=v(n,s.anchor.blockId),o=r??c;if(r&&r.attrs?.listType===i){const i=n.transaction("command");if(t(r))i.setBlockType(r.id,d("paragraph"));else{const t=x(n,r.id);if(!t)return!1;I(i,t)}return i.setSelection(s),e.dispatch(i.build()),!0}const l=y(i,p(o,"list_item")?o.attrs.indent:0),u=n.transaction("command").setBlockType(o.id,d("list_item"),l).setSelection(s).build();return e.dispatch(u),!0}(e,i,n))}function S(t,e,n){const i=t.getState();if(!a(i.selection))return!1;if(i.selection.anchor.blockId!==i.selection.head.blockId)return function(t,e,n,i){const s=e.selection;if(!a(s))return!1;const c=r(s,e.getBlockOrder()),o=e.transaction("command");let l=!1;const u=/* @__PURE__ */new Set;return m(e,c,t=>{const s=v(e,t);if(!s||!p(s,"list_item"))return;if(u.has(s.id))return;u.add(s.id);const c=s.attrs.indent+n;c<0||c>i||(o.setBlockType(s.id,d("list_item"),y(s.attrs.listType,c,s.attrs.checked)),l=!0)}),!!l&&(o.setSelection(s),t.dispatch(o.build()),!0)}(t,i,e,n);const s=i.selection,c=v(i,s.anchor.blockId);if(!c||!p(c,"list_item"))return!1;const o=c.attrs.indent+e;if(o<0||o>n)return!1;const l=y(c.attrs.listType,o,c.attrs.checked),u=i.transaction("command").setBlockType(c.id,d("list_item"),l).setSelection(s).build();return t.dispatch(u),!0}function C(t,e){const{interactiveCheckboxes:n,targetId:i,locale:s}=e;if(t.isReadOnly()&&!n)return!1;const c=t.getState(),r=i??(a(c.selection)?c.selection.anchor.blockId:null);if(!r)return!1;const o=v(c,r);if(!o||!p(o,"list_item")||"checklist"!==o.attrs.listType)return!1;const l=!o.attrs.checked,u=y(o.attrs.listType,o.attrs.indent,l),h=c.transaction("command").setBlockType(o.id,d("list_item"),u).setSelection(c.selection).build();return t.dispatch(h),t.announce(l?s.checkedAnnouncement:s.uncheckedAnnouncement),!0}function B(t,e,n){let i=!0;return m(t,e,e=>{const s=v(t,e);s&&"list_item"===s.type&&s.attrs?.listType===n||(i=!1)}),i}var L=[{type:"bullet",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"/></svg>',inputPattern:/^[-*] $/,inputPrefix:"- "},{type:"ordered",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"/></svg>',inputPattern:/^\d+\. $/,inputPrefix:"1. "},{type:"checklist",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z"/></svg>',inputPattern:/^\[[ x]] $/,inputPrefix:"[ ] "}];function w(t,e){const n=t.getState();if(!a(n.selection))return!1;const i=n.selection;if(!o(i))return!1;const c=n.getBlock(i.anchor.blockId);if(!c)return!1;if("list_item"===c.type)return e({state:n,item:c,child:void 0,childIndex:-1,childCount:0,blockId:i.anchor.blockId,offset:i.anchor.offset});const r=n.getParent(i.anchor.blockId);if(!r||"list_item"!==r.type)return!1;const l=s(r),d=l.findIndex(t=>t.id===c.id);return!(d<0)&&e({state:n,item:r,child:c,childIndex:d,childCount:l.length,blockId:i.anchor.blockId,offset:i.anchor.offset})}var _={bulletList:"Bullet List",numberedList:"Numbered List",checklist:"Checklist",checkboxLabel:"To-do item",checkedAnnouncement:"Checked",uncheckedAnnouncement:"Unchecked"},H=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Cy_77yRf.mjs"),"./locales/de.ts":()=>import("./de-CaeEIyzV.mjs"),"./locales/es.ts":()=>import("./es-DFokqQst.mjs"),"./locales/fr.ts":()=>import("./fr-5HkMazAf.mjs"),"./locales/hi.ts":()=>import("./hi-BzbMD_cP.mjs"),"./locales/pt.ts":()=>import("./pt-CR4j8gtE.mjs"),"./locales/ru.ts":()=>import("./ru-DiwQV30V.mjs"),"./locales/zh.ts":()=>import("./zh-BQqf3wJZ.mjs")});async function z(t){return k(H,t,_)}var A="notectl-checklist-marker";function j(t,e){return{bullet:e.bulletList,ordered:e.numberedList,checklist:e.checklist}[t]}function P(t,e){if(!a(t.selection))return!1;if(t.selection.anchor.blockId!==t.selection.head.blockId)return B(t,r(t.selection,t.getBlockOrder()),e);const n=v(t,t.selection.anchor.blockId);return"list_item"===n?.type&&n.attrs?.listType===e}var $={types:["bullet","ordered","checklist"],maxIndent:4},N=class{id="list";name="List";priority=35;config;locale;context=null;checkboxClickHandler=null;constructor(t){this.config={...$,...t}}async init(t){this.context=t,this.locale=await f(t,this.config.locale,_,z);const s=this.getEnabledTypes();t.registerStyleSheet("\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 24px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Container items (#194): block children inherit the item's start padding.\n Trim the first/last child paragraph padding so the first text line sits on\n the marker's line and the item keeps the leaf item's vertical rhythm. */\n.notectl-list-item > p:first-of-type {\n\tpadding-top: 0;\n}\n\n.notectl-list-item > p:last-of-type {\n\tpadding-bottom: 0;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n"),this.registerNodeSpec(t),function(t,e,n,i){for(const s of n)t.registerCommand(`toggleList:${s.type}`,()=>T(t,s.type));if(t.registerCommand("indentListItem",()=>S(t,1,e.maxIndent)),t.registerCommand("outdentListItem",()=>S(t,-1,e.maxIndent)),e.types.includes("checklist")){const n=()=>C(t,{interactiveCheckboxes:e.interactiveCheckboxes,locale:i});t.registerCommand("toggleChecklistItem",n,{readonlyAllowed:!0}),t.registerKeymap({"Mod-Enter":n},{priority:"navigation"})}t.registerKeymap({Tab:()=>S(t,1,e.maxIndent),"Shift-Tab":()=>S(t,-1,e.maxIndent)})}(t,this.config,s,this.locale),function(t){t.registerKeymap({Enter:()=>function(t){return w(t,s=>{if(s.child)return function(t,e,s){if(!h(s))return!1;if(e.childIndex!==e.childCount-1)return!1;const r=x(e.state,e.item.id);if(!r)return!1;const o=e.state.transaction("input");if(1===e.childCount)return I(o,r),o.setSelection(e.state.selection),t.dispatch(o.build()),!0;const a=p(e.item,"list_item")?e.item.attrs.listType:"bullet",u=p(e.item,"list_item")?e.item.attrs.indent:0,m=n(),k=i(d("list_item"),[c("")],m,y(a,u));return o.removeNode([...r.parentPath,e.item.id],e.childIndex).insertNode(r.parentPath,r.index+1,k).setSelection(l(m,0)),t.dispatch(o.build()),!0}(t,s,s.child);if(""===e(s.item)){const e=s.state.transaction("input").setBlockType(s.blockId,d("paragraph")).setSelection(s.state.selection).build();return t.dispatch(e),!0}const r=n(),o=y(p(s.item,"list_item")?s.item.attrs.listType:"bullet",p(s.item,"list_item")?s.item.attrs.indent:0),a=s.state.transaction("input").splitBlock(s.blockId,s.offset,r).setBlockType(r,d("list_item"),o).setSelection(l(r,0)).build();return t.dispatch(a),!0})}(t),Backspace:()=>function(t){return w(t,e=>{if(0!==e.offset)return!1;if(e.child){if(0!==e.childIndex)return!1;const n=x(e.state,e.item.id);if(!n)return!1;const i=e.state.transaction("input");return I(i,n),i.setSelection(e.state.selection),t.dispatch(i.build()),!0}const n=e.state.transaction("input").setBlockType(e.blockId,d("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0})}(t)})}(t),!1!==this.config.inputRule&&function(t,e){for(const n of e)t.registerInputRule({pattern:n.inputPattern,handler:(t,e,i,s)=>{const c=t.selection;if(!a(c))return null;if(!o(c))return null;const r=t.getBlock(c.anchor.blockId);if(!r||"paragraph"!==r.type)return null;if("list_item"===t.getParent(c.anchor.blockId)?.type)return null;const u=e[0]??"",h=u.length,m=y(n.type,0,u.includes("[x]"));return t.transaction("input").deleteTextAt(c.anchor.blockId,i,i+h).setBlockType(c.anchor.blockId,d("list_item"),m).setSelection(l(c.anchor.blockId,0)).build()}})}(t,s),function(t,e,n){for(const i of e)t.registerToolbarItem({id:`list-${i.type}`,group:"block",icon:i.icon,label:j(i.type,n),command:`toggleList:${i.type}`,isActive:t=>P(t,i.type)})}(t,s,this.locale),this.registerCheckboxClickHandler(t)}destroy(){this.checkboxClickHandler&&this.context&&this.context.getContainer().removeEventListener("mousedown",this.checkboxClickHandler),this.checkboxClickHandler=null,this.context=null}registerNodeSpec(t){const e=this.locale.checkboxLabel;t.registerNodeSpec({type:"list_item",group:"block",content:{allow:["text","paragraph","heading","code_block","blockquote","horizontal_rule"]},attrs:{listType:{default:"bullet"},indent:{default:0},checked:{default:!1}},toDOM(t){const n=t.attrs?.listType??"bullet",i=t.attrs?.indent??0,s=t.attrs?.checked??!1,c=g("li",t.id);return c.setAttribute("role","listitem"),c.setAttribute("data-list-type",n),c.setAttribute("data-indent",String(i)),c.className=`notectl-list-item notectl-list-item--${n}`,i>0&&b(c,"marginLeft",24*i+"px"),"checklist"===n&&(c.setAttribute("data-checked",String(s)),c.appendChild(function(t,e){const n=document.createElement("span");return n.className=A,n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",String(t)),n.setAttribute("aria-label",e),n.setAttribute("contenteditable","false"),n.setAttribute("data-widget","true"),n}(s,e))),c.setAttribute("aria-level",String(i+1)),c},wrapper(t){const e=t.attrs?.listType??"bullet";return{tag:"ordered"===e?"ol":"ul",key:`list-${e}`,className:`notectl-list notectl-list--${e}`,attrs:{role:"list"}}},toHTML(t,e){const n=t.attrs?.listType??"bullet",i=t.attrs?.checked??!1;return"checklist"===n?`<li role="checkbox" aria-checked="${String(i)}"><input type="checkbox" disabled${i?" checked":""}>${e||"<br>"}</li>`:`<li>${e||"<br>"}</li>`},parseHTML:[{tag:"li"}],sanitize:{tags:["ul","ol","li","input"],attrs:["type","disabled","checked","role","aria-checked"]}})}registerCheckboxClickHandler(t){this.config.types.includes("checklist")&&(this.checkboxClickHandler=e=>{if(t.isReadOnly()&&!this.config.interactiveCheckboxes)return;const n=e.target;if(!(n instanceof HTMLElement))return;const i=n.closest(`.${A}`);if(!i)return;const s=i.closest(".notectl-list-item--checklist");if(!s)return;e.preventDefault();const c=s.getAttribute("data-block-id");c&&C(t,{interactiveCheckboxes:this.config.interactiveCheckboxes,targetId:u(c),locale:this.locale})},t.getContainer().addEventListener("mousedown",this.checkboxClickHandler))}getEnabledTypes(){return L.filter(t=>this.config.types.includes(t.type))}};export{_ as n,z as r,N as t};
|
|
2
|
+
//# sourceMappingURL=ListPlugin-BchSFWVn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListPlugin-BchSFWVn.mjs","names":[],"sources":["../../src/editor/styles/list.ts","../../src/plugins/list/ListAttrsFactory.ts","../../src/plugins/list/ListItemContext.ts","../../src/plugins/list/ListCommands.ts","../../src/plugins/list/ListDefinitions.ts","../../src/plugins/list/ListInputRules.ts","../../src/plugins/list/ListKeyboardHandlers.ts","../../src/plugins/list/ListLocale.ts","../../src/plugins/list/ListMarker.ts","../../src/plugins/list/ListToolbarItems.ts","../../src/plugins/list/ListPlugin.ts"],"sourcesContent":["/** Width of the list marker / checkbox area in pixels. */\nexport const LIST_MARKER_WIDTH = 24;\n\n/** List styles — bullet, ordered, checklist items. */\nexport const LIST_CSS = `\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: ${LIST_MARKER_WIDTH}px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Container items (#194): block children inherit the item's start padding.\n Trim the first/last child paragraph padding so the first text line sits on\n the marker's line and the item keeps the leaf item's vertical rhythm. */\n.notectl-list-item > p:first-of-type {\n\tpadding-top: 0;\n}\n\n.notectl-list-item > p:last-of-type {\n\tpadding-bottom: 0;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n`;\n","/**\n * Factory for building list item block attributes.\n * Centralizes attribute construction to avoid repetitive inline object literals.\n */\n\nimport type { BlockAttrs } from '../../model/Document.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Builds a `BlockAttrs` object for a list_item block. */\nexport function buildListItemAttrs(\n\tlistType: ListType,\n\tindent: number,\n\tchecked?: boolean,\n): BlockAttrs {\n\tif (listType === 'checklist') {\n\t\treturn { listType, indent, checked: checked ?? false };\n\t}\n\treturn { listType, indent };\n}\n","/**\n * Shared resolution helpers for container list items (#194).\n *\n * With `list_item` a hybrid leaf/container block, the caret may sit inside a\n * block child of an item. Commands and keyboard handlers resolve the owning\n * item through the ancestor chain and address structural edits through the\n * item's location (parent path + child index), mirroring the blockquote\n * container conventions.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { getBlockChildren } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { TransactionBuilder } from '../../state/TransactionBuilder.js';\n\n/** A list item's structural address: its parent path and child index. */\nexport interface ListItemLocation {\n\treadonly item: BlockNode;\n\t/** Path from the document root to the item's parent ([] = root). */\n\treadonly parentPath: readonly BlockId[];\n\t/** The item's index among its parent's block children. */\n\treadonly index: number;\n}\n\n/**\n * Resolves the list item owning a block: the block itself when it is a\n * `list_item`, otherwise its nearest `list_item` ancestor.\n */\nexport function resolveListItem(state: EditorState, id: BlockId): BlockNode | undefined {\n\tconst block: BlockNode | undefined = state.getBlock(id);\n\tif (block?.type === 'list_item') return block;\n\tconst path: readonly BlockId[] | undefined = state.getNodePath(id);\n\tif (!path) return undefined;\n\tfor (let i = path.length - 2; i >= 0; i--) {\n\t\tconst ancestorId: BlockId | undefined = path[i];\n\t\tconst ancestor: BlockNode | undefined = ancestorId ? state.getBlock(ancestorId) : undefined;\n\t\tif (ancestor?.type === 'list_item') return ancestor;\n\t}\n\treturn undefined;\n}\n\n/** Locates a list item's structural address, or undefined if it is not found. */\nexport function locateListItem(state: EditorState, itemId: BlockId): ListItemLocation | undefined {\n\tconst item: BlockNode | undefined = state.getBlock(itemId);\n\tif (!item || item.type !== 'list_item') return undefined;\n\tconst path: readonly BlockId[] | undefined = state.getNodePath(itemId);\n\tif (!path) return undefined;\n\n\tconst parentPath: readonly BlockId[] = path.slice(0, -1);\n\tconst parentId: BlockId | undefined = parentPath[parentPath.length - 1];\n\tconst siblings: readonly BlockNode[] = parentId\n\t\t? getBlockChildren(state.getBlock(parentId) as BlockNode)\n\t\t: state.doc.children;\n\tconst index: number = siblings.findIndex((sibling) => sibling.id === itemId);\n\tif (index < 0) return undefined;\n\treturn { item, parentPath, index };\n}\n\n/**\n * Replaces a container list item with its block children in place. The\n * children keep their IDs, so a selection inside them survives the lift.\n * Leaf items must not be dissolved (their inline content is not a block);\n * convert those via `setBlockType` instead.\n */\nexport function dissolveListItem(builder: TransactionBuilder, location: ListItemLocation): void {\n\tbuilder.removeNode(location.parentPath, location.index);\n\tconst children: readonly BlockNode[] = getBlockChildren(location.item);\n\tchildren.forEach((child, offset) => {\n\t\tbuilder.insertNode(location.parentPath, location.index + offset, child);\n\t});\n}\n","/**\n * Command registration and implementations for list block types.\n * Handles toggle between list types and paragraph, indent/outdent,\n * and checklist toggle.\n */\n\nimport { forEachBlockIdInRange } from '../../commands/RangeIterator.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { isLeafBlock } from '../../model/Document.js';\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport { type BlockId, nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport { dissolveListItem, locateListItem, resolveListItem } from './ListItemContext.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListConfig, ListType } from './ListPlugin.js';\n\n/** Registers all list commands (toggleList:*, indent, outdent, toggleChecklistItem). */\nexport function registerListCommands(\n\tcontext: PluginContext,\n\tconfig: ListConfig,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerCommand(`toggleList:${def.type}`, () => {\n\t\t\treturn toggleList(context, def.type);\n\t\t});\n\t}\n\n\tcontext.registerCommand('indentListItem', () => changeIndent(context, 1, config.maxIndent));\n\n\tcontext.registerCommand('outdentListItem', () => changeIndent(context, -1, config.maxIndent));\n\n\tif (config.types.includes('checklist')) {\n\t\tconst toggleChecklistItem = (): boolean =>\n\t\t\ttoggleChecked(context, { interactiveCheckboxes: config.interactiveCheckboxes, locale });\n\n\t\tcontext.registerCommand('toggleChecklistItem', toggleChecklistItem, {\n\t\t\treadonlyAllowed: true,\n\t\t});\n\n\t\t// Mod-Enter gives keyboard-only users a way to toggle a checklist item\n\t\t// (WCAG 2.1.1). The handler declines on non-checklist blocks, so it falls\n\t\t// through to other Mod-Enter bindings (e.g. code-block insert-after).\n\t\t// Registered at navigation priority so it stays reachable in read-only mode\n\t\t// when interactiveCheckboxes is enabled, matching the mouse handler.\n\t\tcontext.registerKeymap({ 'Mod-Enter': toggleChecklistItem }, { priority: 'navigation' });\n\t}\n\n\tcontext.registerKeymap({\n\t\tTab: () => changeIndent(context, 1, config.maxIndent),\n\t\t'Shift-Tab': () => changeIndent(context, -1, config.maxIndent),\n\t});\n}\n\n// --- Command Implementations ---\n\nfunction toggleList(context: PluginContext, listType: ListType): boolean {\n\tconst state: EditorState = context.getState();\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (sel.anchor.blockId !== sel.head.blockId) {\n\t\treturn toggleListRange(context, state, listType);\n\t}\n\treturn toggleListSingleBlock(context, state, listType);\n}\n\nfunction toggleListSingleBlock(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tlistType: ListType,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\t// The caret may sit inside a block child of a container item (#194):\n\t// toggling always targets the owning item, never the child.\n\tconst item: BlockNode | undefined = resolveListItem(state, sel.anchor.blockId);\n\tconst target: BlockNode = item ?? block;\n\n\tif (item && item.attrs?.listType === listType) {\n\t\tconst builder = state.transaction('command');\n\t\tif (isLeafBlock(item)) {\n\t\t\tbuilder.setBlockType(item.id, nodeType('paragraph'));\n\t\t} else {\n\t\t\t// A container item cannot become a paragraph (its children are\n\t\t\t// blocks) — dissolve it into those children instead.\n\t\t\tconst location = locateListItem(state, item.id);\n\t\t\tif (!location) return false;\n\t\t\tdissolveListItem(builder, location);\n\t\t}\n\t\tbuilder.setSelection(sel);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\tconst existingIndent: number = isNodeOfType(target, 'list_item') ? target.attrs.indent : 0;\n\tconst attrs = buildListItemAttrs(listType, existingIndent);\n\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(target.id, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction toggleListRange(context: PluginContext, state: EditorState, listType: ListType): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst toggleOff: boolean = allBlocksMatchListType(state, range, listType);\n\tconst builder = state.transaction('command');\n\n\t// Children of a container item resolve to their owning item (#194), so a\n\t// range over its paragraphs toggles the item once, not each child.\n\tconst targets: BlockNode[] = collectToggleTargets(state, range);\n\n\t// Dissolving replaces one node with several, shifting later sibling\n\t// indices — process targets back-to-front so earlier addresses stay valid.\n\tfor (let i = targets.length - 1; i >= 0; i--) {\n\t\tconst target: BlockNode | undefined = targets[i];\n\t\tif (!target) continue;\n\n\t\tif (toggleOff) {\n\t\t\tif (isLeafBlock(target)) {\n\t\t\t\tbuilder.setBlockType(target.id, nodeType('paragraph'));\n\t\t\t} else {\n\t\t\t\tconst location = locateListItem(state, target.id);\n\t\t\t\tif (location) dissolveListItem(builder, location);\n\t\t\t}\n\t\t} else {\n\t\t\tconst existingIndent: number = isNodeOfType(target, 'list_item') ? target.attrs.indent : 0;\n\t\t\tconst existingChecked: boolean =\n\t\t\t\tisNodeOfType(target, 'list_item') &&\n\t\t\t\ttarget.attrs.listType === 'checklist' &&\n\t\t\t\ttarget.attrs.checked;\n\t\t\tbuilder.setBlockType(\n\t\t\t\ttarget.id,\n\t\t\t\tnodeType('list_item'),\n\t\t\t\tbuildListItemAttrs(listType, existingIndent, existingChecked),\n\t\t\t);\n\t\t}\n\t}\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Collects unique toggle targets: each leaf block or its owning list item. */\nfunction collectToggleTargets(\n\tstate: EditorState,\n\trange: ReturnType<typeof selectionRange>,\n): BlockNode[] {\n\tconst targets: BlockNode[] = [];\n\tconst seen = new Set<BlockId>();\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = state.getBlock(bid);\n\t\tif (!block) return;\n\t\tconst target: BlockNode = resolveListItem(state, bid) ?? block;\n\t\tif (seen.has(target.id)) return;\n\t\tseen.add(target.id);\n\t\ttargets.push(target);\n\t});\n\treturn targets;\n}\n\n// --- Indent / Outdent ---\n\nfunction changeIndent(context: PluginContext, delta: 1 | -1, maxIndent: number): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\treturn changeIndentRange(context, state, delta, maxIndent);\n\t}\n\n\tconst sel = state.selection;\n\tconst block = resolveListItem(state, sel.anchor.blockId);\n\tif (!block || !isNodeOfType(block, 'list_item')) return false;\n\n\tconst newIndent: number = block.attrs.indent + delta;\n\tif (newIndent < 0 || newIndent > maxIndent) return false;\n\n\tconst attrs = buildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked);\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(block.id, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction changeIndentRange(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tdelta: 1 | -1,\n\tmaxIndent: number,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\tlet changed = false;\n\tconst seen = new Set<BlockId>();\n\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = resolveListItem(state, bid);\n\t\tif (!block || !isNodeOfType(block, 'list_item')) return;\n\t\tif (seen.has(block.id)) return;\n\t\tseen.add(block.id);\n\n\t\tconst newIndent: number = block.attrs.indent + delta;\n\t\tif (newIndent < 0 || newIndent > maxIndent) return;\n\n\t\tbuilder.setBlockType(\n\t\t\tblock.id,\n\t\t\tnodeType('list_item'),\n\t\t\tbuildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked),\n\t\t);\n\t\tchanged = true;\n\t});\n\n\tif (!changed) return false;\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Checklist Toggle ---\n\n/** Options for {@link toggleChecked}. */\nexport interface ToggleCheckedOptions {\n\t/** When true, the toggle is allowed even in read-only mode. */\n\treadonly interactiveCheckboxes?: boolean;\n\t/** Specific checklist item to toggle. Defaults to the selection's block. */\n\treadonly targetId?: BlockId;\n\t/** Locale used for the screen-reader announcement of the new state. */\n\treadonly locale: ListLocale;\n}\n\n/**\n * Toggles the checked state of a checklist item and announces the new state to\n * screen readers. Exported for use in the checkbox click handler.\n */\nexport function toggleChecked(context: PluginContext, options: ToggleCheckedOptions): boolean {\n\tconst { interactiveCheckboxes, targetId, locale } = options;\n\tif (context.isReadOnly() && !interactiveCheckboxes) return false;\n\n\tconst state: EditorState = context.getState();\n\tconst bid: BlockId | null =\n\t\ttargetId ?? (!isTextSelection(state.selection) ? null : state.selection.anchor.blockId);\n\tif (!bid) return false;\n\n\tconst block = resolveListItem(state, bid);\n\tif (!block || !isNodeOfType(block, 'list_item') || block.attrs.listType !== 'checklist') {\n\t\treturn false;\n\t}\n\n\tconst nextChecked: boolean = !block.attrs.checked;\n\tconst attrs = buildListItemAttrs(block.attrs.listType, block.attrs.indent, nextChecked);\n\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(block.id, nodeType('list_item'), attrs)\n\t\t.setSelection(state.selection)\n\t\t.build();\n\tcontext.dispatch(tr);\n\n\t// The marker is not focused while editing, so the aria-checked change alone is\n\t// not spoken — announce the new state explicitly (WCAG 4.1.3).\n\tcontext.announce(nextChecked ? locale.checkedAnnouncement : locale.uncheckedAnnouncement);\n\treturn true;\n}\n\n// --- Helpers ---\n\n/**\n * Checks whether all blocks in a range belong to list items of the given type\n * (children of container items resolve to their owning item, #194). Exported\n * for toolbar active-state detection.\n */\nexport function allBlocksMatchListType(\n\tstate: EditorState,\n\trange: ReturnType<typeof selectionRange>,\n\tlistType: ListType,\n): boolean {\n\tlet allMatch = true;\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = resolveListItem(state, bid);\n\t\tif (!block || block.type !== 'list_item' || block.attrs?.listType !== listType) {\n\t\t\tallMatch = false;\n\t\t}\n\t});\n\treturn allMatch;\n}\n","/**\n * List type metadata: icons, patterns, and type definitions.\n * Pure data constants shared across list plugin modules.\n */\n\nimport type { ListType } from './ListPlugin.js';\n\n// --- List Type Metadata ---\n\nexport interface ListTypeDefinition {\n\treadonly type: ListType;\n\treadonly icon: string;\n\treadonly inputPattern: RegExp;\n\treadonly inputPrefix: string;\n}\n\nconst BULLET_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z\"/></svg>';\nconst NUMBERED_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z\"/></svg>';\nconst CHECKLIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z\"/></svg>';\n\nexport const LIST_TYPE_DEFINITIONS: readonly ListTypeDefinition[] = [\n\t{\n\t\ttype: 'bullet',\n\t\ticon: BULLET_LIST_ICON,\n\t\tinputPattern: /^[-*] $/,\n\t\tinputPrefix: '- ',\n\t},\n\t{\n\t\ttype: 'ordered',\n\t\ticon: NUMBERED_LIST_ICON,\n\t\tinputPattern: /^\\d+\\. $/,\n\t\tinputPrefix: '1. ',\n\t},\n\t{\n\t\ttype: 'checklist',\n\t\ticon: CHECKLIST_ICON,\n\t\tinputPattern: /^\\[[ x]] $/,\n\t\tinputPrefix: '[ ] ',\n\t},\n];\n","/**\n * Input rule registration for list block types.\n * Converts `- `, `* `, `1. `, `[ ] `, `[x] ` at the start of a paragraph into list items.\n */\n\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\n\n/** Registers markdown-style input rules for configured list types. */\nexport function registerListInputRules(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: def.inputPattern,\n\t\t\thandler: (state, match, start, _end) => {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\t// Inside a container list item (#194) the rule must not fire: it\n\t\t\t\t// would nest a list_item into a list_item, which the schema forbids.\n\t\t\t\tconst parent = state.getParent(sel.anchor.blockId);\n\t\t\t\tif (parent?.type === 'list_item') return null;\n\n\t\t\t\tconst matchStr = match[0] ?? '';\n\t\t\t\tconst matchLen = matchStr.length;\n\t\t\t\tconst attrs = buildListItemAttrs(def.type, 0, matchStr.includes('[x]'));\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + matchLen)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n}\n","/**\n * Keyboard handlers for list block types.\n *\n * Leaf items: Enter splits into a new item (or exits an empty item),\n * Backspace at the start converts back to a paragraph.\n *\n * Container items (#194): the caret sits inside a block child. Enter on an\n * empty trailing child exits into a new sibling item (Enter-Enter continues\n * the list); Backspace at the start of the first child dissolves the item\n * into its children — both mirroring the blockquote container conventions.\n * Everything else falls through to the default split/merge behavior.\n */\n\nimport { isEmptyParagraph } from '../../commands/BlockInsertion.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { generateBlockId, getBlockChildren, getBlockText } from '../../model/Document.js';\nimport { createBlockNode, createTextNode } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport { type ListItemLocation, dissolveListItem, locateListItem } from './ListItemContext.js';\n\n// --- Context Guard ---\n\ninterface ListContext {\n\treadonly state: EditorState;\n\t/** The list item owning the caret (the caret block itself for leaf items). */\n\treadonly item: BlockNode;\n\t/** The caret's block child of a container item; undefined for leaf items. */\n\treadonly child: BlockNode | undefined;\n\treadonly childIndex: number;\n\treadonly childCount: number;\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Guards against NodeSelection, non-collapsed selections, and carets outside\n * list items. Resolves both leaf items (caret directly inside the item) and\n * container items (caret inside a direct block child of the item).\n */\nfunction withListContext(context: PluginContext, handler: (ctx: ListContext) => boolean): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst sel = state.selection;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === 'list_item') {\n\t\treturn handler({\n\t\t\tstate,\n\t\t\titem: block,\n\t\t\tchild: undefined,\n\t\t\tchildIndex: -1,\n\t\t\tchildCount: 0,\n\t\t\tblockId: sel.anchor.blockId,\n\t\t\toffset: sel.anchor.offset,\n\t\t});\n\t}\n\n\tconst parent: BlockNode | undefined = state.getParent(sel.anchor.blockId);\n\tif (!parent || parent.type !== 'list_item') return false;\n\tconst children: readonly BlockNode[] = getBlockChildren(parent);\n\tconst childIndex: number = children.findIndex((c) => c.id === block.id);\n\tif (childIndex < 0) return false;\n\n\treturn handler({\n\t\tstate,\n\t\titem: parent,\n\t\tchild: block,\n\t\tchildIndex,\n\t\tchildCount: children.length,\n\t\tblockId: sel.anchor.blockId,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers Enter and Backspace keymaps for list items. */\nexport function registerListKeymaps(context: PluginContext): void {\n\tcontext.registerKeymap({\n\t\tEnter: () => handleEnter(context),\n\t\tBackspace: () => handleBackspace(context),\n\t});\n}\n\n// --- Enter Handler ---\n\n/**\n * Handles Enter inside a list item.\n * Leaf items: empty → exit list (convert to paragraph); non-empty → split\n * into a new item of the same type.\n * Container items: an empty trailing child exits into a new sibling item;\n * a lone empty child dissolves the item. Everything else falls through to\n * the default split (which grows the item's children).\n */\nfunction handleEnter(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tif (ctx.child) return handleEnterInContainerChild(context, ctx, ctx.child);\n\n\t\tconst text: string = getBlockText(ctx.item);\n\n\t\tif (text === '') {\n\t\t\tconst tr = ctx.state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(ctx.state.selection)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst newBlockId = generateBlockId();\n\t\tconst listType = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.listType : 'bullet';\n\t\tconst indent: number = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.indent : 0;\n\t\tconst attrs = buildListItemAttrs(listType, indent);\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.splitBlock(ctx.blockId, ctx.offset, newBlockId)\n\t\t\t.setBlockType(newBlockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(createCollapsedSelection(newBlockId, 0))\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n\n/** Enter inside a container item's child: exit on an empty trailing child. */\nfunction handleEnterInContainerChild(\n\tcontext: PluginContext,\n\tctx: ListContext,\n\tchild: BlockNode,\n): boolean {\n\tif (!isEmptyParagraph(child)) return false;\n\tif (ctx.childIndex !== ctx.childCount - 1) return false;\n\n\tconst location: ListItemLocation | undefined = locateListItem(ctx.state, ctx.item.id);\n\tif (!location) return false;\n\n\tconst builder = ctx.state.transaction('input');\n\n\tif (ctx.childCount === 1) {\n\t\t// A lone empty child: the item has no content left — dissolve it and\n\t\t// keep the paragraph (same ID, so the caret stays put).\n\t\tdissolveListItem(builder, location);\n\t\tbuilder.setSelection(ctx.state.selection);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\t// Drop the empty trailing child and continue the list with a fresh item.\n\tconst listType = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.listType : 'bullet';\n\tconst indent: number = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.indent : 0;\n\tconst newItemId = generateBlockId();\n\tconst newItem: BlockNode = createBlockNode(\n\t\tnodeType('list_item'),\n\t\t[createTextNode('')],\n\t\tnewItemId,\n\t\tbuildListItemAttrs(listType, indent),\n\t);\n\n\tbuilder\n\t\t.removeNode([...location.parentPath, ctx.item.id], ctx.childIndex)\n\t\t.insertNode(location.parentPath, location.index + 1, newItem)\n\t\t.setSelection(createCollapsedSelection(newItemId, 0));\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Backspace Handler ---\n\n/**\n * Handles Backspace at the start of a list item.\n * Leaf items convert back to a paragraph. Container items dissolve into\n * their block children when the caret sits at the very start of the first\n * child (the un-list gesture); later children fall through to the default\n * sibling merge.\n */\nfunction handleBackspace(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tif (ctx.offset !== 0) return false;\n\n\t\tif (ctx.child) {\n\t\t\tif (ctx.childIndex !== 0) return false;\n\t\t\tconst location: ListItemLocation | undefined = locateListItem(ctx.state, ctx.item.id);\n\t\t\tif (!location) return false;\n\t\t\tconst builder = ctx.state.transaction('input');\n\t\t\tdissolveListItem(builder, location);\n\t\t\tbuilder.setSelection(ctx.state.selection);\n\t\t\tcontext.dispatch(builder.build());\n\t\t\treturn true;\n\t\t}\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t.setSelection(ctx.state.selection)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n","/**\n * Locale interface and default English locale for the ListPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface ListLocale {\n\treadonly bulletList: string;\n\treadonly numberedList: string;\n\treadonly checklist: string;\n\t/** Accessible name for the checklist item's checkbox marker (screen readers). */\n\treadonly checkboxLabel: string;\n\t/** Announced when a checklist item is toggled on. */\n\treadonly checkedAnnouncement: string;\n\t/** Announced when a checklist item is toggled off. */\n\treadonly uncheckedAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const LIST_LOCALE_EN: ListLocale = {\n\tbulletList: 'Bullet List',\n\tnumberedList: 'Numbered List',\n\tchecklist: 'Checklist',\n\tcheckboxLabel: 'To-do item',\n\tcheckedAnnouncement: 'Checked',\n\tuncheckedAnnouncement: 'Unchecked',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<ListLocale> = import.meta.glob<{\n\tdefault: ListLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadListLocale(lang: string): Promise<ListLocale> {\n\treturn loadLocaleModule(localeModules, lang, LIST_LOCALE_EN);\n}\n","/**\n * Accessible checkbox marker for checklist items.\n *\n * The marker is a real `role=\"checkbox\"` element so assistive technology can\n * announce the item's checked state (WCAG 4.1.2 Name, Role, Value). It is\n * rendered `contenteditable=\"false\"` and flagged `data-widget` so the selection\n * layer treats it as zero-width view chrome, never as document content or a caret\n * position. The visible checkbox glyph is drawn in CSS.\n */\n\n/** CSS class identifying the checklist checkbox marker element. */\nexport const CHECKLIST_MARKER_CLASS = 'notectl-checklist-marker';\n\n/** Creates the accessible checkbox marker for a checklist item. */\nexport function createChecklistMarker(checked: boolean, label: string): HTMLElement {\n\tconst marker: HTMLElement = document.createElement('span');\n\tmarker.className = CHECKLIST_MARKER_CLASS;\n\tmarker.setAttribute('role', 'checkbox');\n\tmarker.setAttribute('aria-checked', String(checked));\n\tmarker.setAttribute('aria-label', label);\n\tmarker.setAttribute('contenteditable', 'false');\n\tmarker.setAttribute('data-widget', 'true');\n\treturn marker;\n}\n","/**\n * Toolbar item registration for list block types.\n * Registers bullet, ordered, and checklist toolbar buttons with active-state detection.\n */\n\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { allBlocksMatchListType } from './ListCommands.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport { resolveListItem } from './ListItemContext.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Registers toolbar items for each enabled list type. */\nexport function registerListToolbarItems(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: `list-${def.type}`,\n\t\t\tgroup: 'block',\n\t\t\ticon: def.icon,\n\t\t\tlabel: getListLabel(def.type, locale),\n\t\t\tcommand: `toggleList:${def.type}`,\n\t\t\tisActive: (state) => isListActive(state, def.type),\n\t\t});\n\t}\n}\n\n// --- Helpers ---\n\nfunction getListLabel(type: ListType, locale: ListLocale): string {\n\tconst labels: Record<ListType, string> = {\n\t\tbullet: locale.bulletList,\n\t\tordered: locale.numberedList,\n\t\tchecklist: locale.checklist,\n\t};\n\treturn labels[type];\n}\n\nfunction isListActive(state: EditorState, listType: ListType): boolean {\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\t\treturn allBlocksMatchListType(state, range, listType);\n\t}\n\n\t// Children of container items resolve to their owning item (#194).\n\tconst block = resolveListItem(state, state.selection.anchor.blockId);\n\treturn block?.type === 'list_item' && block.attrs?.listType === listType;\n}\n","/**\n * ListPlugin: registers ordered, unordered, and checklist block types\n * with NodeSpecs, toggle commands, indent/outdent (Tab/Shift-Tab),\n * input rules, and toolbar buttons.\n *\n * This file is a thin orchestrator — command logic, input rules, keyboard\n * handlers, and toolbar rendering are delegated to dedicated modules.\n *\n * Sibling structure is modeled flat: every item carries a `listType` and an\n * `indent` attribute, so nesting between items needs no deep tree. Item\n * content is hybrid (#194): a single-paragraph item is a leaf with inline\n * children, while a multi-block item (second paragraph, code block, quote,\n * heading) is a container whose children are blocks.\n */\n\nimport { LIST_CSS, LIST_MARKER_WIDTH } from '../../editor/styles/list.js';\nimport { blockId } from '../../model/TypeBrands.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { registerListCommands, toggleChecked } from './ListCommands.js';\nimport { LIST_TYPE_DEFINITIONS, type ListTypeDefinition } from './ListDefinitions.js';\nimport { registerListInputRules } from './ListInputRules.js';\nimport { registerListKeymaps } from './ListKeyboardHandlers.js';\nimport { LIST_LOCALE_EN, type ListLocale, loadListLocale } from './ListLocale.js';\nimport { CHECKLIST_MARKER_CLASS, createChecklistMarker } from './ListMarker.js';\nimport { registerListToolbarItems } from './ListToolbarItems.js';\n\n// --- Attribute Registry Augmentation ---\n\nexport type ListType = 'bullet' | 'ordered' | 'checklist';\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tlist_item: { listType: ListType; indent: number; checked: boolean };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface ListConfig {\n\t/** Which list types to enable. Defaults to all. */\n\treadonly types: readonly ListType[];\n\t/** Maximum indent depth. Defaults to 4. */\n\treadonly maxIndent: number;\n\t/** Live Markdown shortcuts: `- `/`* ` (bullet), `1. ` (ordered), `[ ] ` (checklist). Default true. */\n\treadonly inputRule?: boolean;\n\t/**\n\t * When true, checklist checkboxes remain interactive even in read-only mode.\n\t * Defaults to false (checkboxes are fully read-only).\n\t */\n\treadonly interactiveCheckboxes?: boolean;\n\treadonly locale?: ListLocale;\n}\n\nconst DEFAULT_CONFIG: ListConfig = {\n\ttypes: ['bullet', 'ordered', 'checklist'],\n\tmaxIndent: 4,\n};\n\n// --- Plugin ---\n\nexport class ListPlugin implements Plugin {\n\treadonly id = 'list';\n\treadonly name = 'List';\n\treadonly priority = 35;\n\n\tprivate readonly config: ListConfig;\n\tprivate locale!: ListLocale;\n\tprivate context: PluginContext | null = null;\n\tprivate checkboxClickHandler: ((e: MouseEvent) => void) | null = null;\n\n\tconstructor(config?: Partial<ListConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.context = context;\n\t\tthis.locale = await resolveLocale(context, this.config.locale, LIST_LOCALE_EN, loadListLocale);\n\t\tconst enabledTypes = this.getEnabledTypes();\n\n\t\tcontext.registerStyleSheet(LIST_CSS);\n\t\tthis.registerNodeSpec(context);\n\t\tregisterListCommands(context, this.config, enabledTypes, this.locale);\n\t\tregisterListKeymaps(context);\n\t\tif (this.config.inputRule !== false) registerListInputRules(context, enabledTypes);\n\t\tregisterListToolbarItems(context, enabledTypes, this.locale);\n\t\tthis.registerCheckboxClickHandler(context);\n\t}\n\n\tdestroy(): void {\n\t\tif (this.checkboxClickHandler && this.context) {\n\t\t\tconst container: HTMLElement = this.context.getContainer();\n\t\t\tcontainer.removeEventListener('mousedown', this.checkboxClickHandler);\n\t\t}\n\t\tthis.checkboxClickHandler = null;\n\t\tthis.context = null;\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tconst checkboxLabel: string = this.locale.checkboxLabel;\n\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'list_item',\n\t\t\tgroup: 'block',\n\t\t\t// Hybrid content model (#194): the common single-paragraph item is a\n\t\t\t// leaf (inline text children); multi-block items are containers with\n\t\t\t// block children. Sibling nesting stays flat-with-indent, so list_item\n\t\t\t// itself is deliberately not an allowed child.\n\t\t\tcontent: {\n\t\t\t\tallow: ['text', 'paragraph', 'heading', 'code_block', 'blockquote', 'horizontal_rule'],\n\t\t\t},\n\t\t\tattrs: {\n\t\t\t\tlistType: { default: 'bullet' },\n\t\t\t\tindent: { default: 0 },\n\t\t\t\tchecked: { default: false },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst indent = node.attrs?.indent ?? 0;\n\t\t\t\tconst checked = node.attrs?.checked ?? false;\n\n\t\t\t\tconst li = createBlockElement('li', node.id);\n\t\t\t\tli.setAttribute('role', 'listitem');\n\t\t\t\tli.setAttribute('data-list-type', listType);\n\t\t\t\tli.setAttribute('data-indent', String(indent));\n\t\t\t\tli.className = `notectl-list-item notectl-list-item--${listType}`;\n\n\t\t\t\tif (indent > 0) {\n\t\t\t\t\tsetStyleProperty(li, 'marginLeft', `${indent * LIST_MARKER_WIDTH}px`);\n\t\t\t\t}\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\t// `data-checked` drives the CSS glyph; the checked state is exposed to\n\t\t\t\t\t// assistive technology via the marker's own role=\"checkbox\", not via an\n\t\t\t\t\t// (invalid) aria-checked on the listitem. The marker is the first child\n\t\t\t\t\t// so reconciled inline content is appended after it.\n\t\t\t\t\tli.setAttribute('data-checked', String(checked));\n\t\t\t\t\tli.appendChild(createChecklistMarker(checked, checkboxLabel));\n\t\t\t\t}\n\t\t\t\tli.setAttribute('aria-level', String(indent + 1));\n\n\t\t\t\treturn li;\n\t\t\t},\n\t\t\twrapper(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst tag = listType === 'ordered' ? 'ol' : 'ul';\n\t\t\t\treturn {\n\t\t\t\t\ttag,\n\t\t\t\t\tkey: `list-${listType}`,\n\t\t\t\t\tclassName: `notectl-list notectl-list--${listType}`,\n\t\t\t\t\tattrs: { role: 'list' },\n\t\t\t\t};\n\t\t\t},\n\t\t\ttoHTML(node, content) {\n\t\t\t\tconst listType: string = (node.attrs?.listType as string) ?? 'bullet';\n\t\t\t\tconst checked: boolean = (node.attrs?.checked as boolean) ?? false;\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\tconst checkedAttr: string = checked ? ' checked' : '';\n\t\t\t\t\tconst ariaChecked: string = String(checked);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t`<li role=\"checkbox\" aria-checked=\"${ariaChecked}\">` +\n\t\t\t\t\t\t`<input type=\"checkbox\" disabled${checkedAttr}>` +\n\t\t\t\t\t\t`${content || '<br>'}</li>`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn `<li>${content || '<br>'}</li>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'li' }],\n\t\t\tsanitize: {\n\t\t\t\ttags: ['ul', 'ol', 'li', 'input'],\n\t\t\t\tattrs: ['type', 'disabled', 'checked', 'role', 'aria-checked'],\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerCheckboxClickHandler(context: PluginContext): void {\n\t\tif (!this.config.types.includes('checklist')) return;\n\n\t\tthis.checkboxClickHandler = (e: MouseEvent) => {\n\t\t\tif (context.isReadOnly() && !this.config.interactiveCheckboxes) return;\n\n\t\t\tconst target: EventTarget | null = e.target;\n\t\t\tif (!(target instanceof HTMLElement)) return;\n\n\t\t\t// Toggle only when the checkbox marker itself is clicked. The marker is a\n\t\t\t// real element, so this is precise — no geometry/RTL math needed.\n\t\t\tconst marker: Element | null = target.closest(`.${CHECKLIST_MARKER_CLASS}`);\n\t\t\tif (!marker) return;\n\n\t\t\tconst li: Element | null = marker.closest('.notectl-list-item--checklist');\n\t\t\tif (!li) return;\n\n\t\t\te.preventDefault();\n\n\t\t\tconst bid: string | null = li.getAttribute('data-block-id');\n\t\t\tif (!bid) return;\n\n\t\t\ttoggleChecked(context, {\n\t\t\t\tinteractiveCheckboxes: this.config.interactiveCheckboxes,\n\t\t\t\ttargetId: blockId(bid),\n\t\t\t\tlocale: this.locale,\n\t\t\t});\n\t\t};\n\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tcontainer.addEventListener('mousedown', this.checkboxClickHandler);\n\t}\n\n\tprivate getEnabledTypes(): readonly ListTypeDefinition[] {\n\t\treturn LIST_TYPE_DEFINITIONS.filter((def) => this.config.types.includes(def.type));\n\t}\n}\n"],"mappings":"weCSA,SAAgB,EACf,EACA,EACA,GAEA,MAAiB,cAAb,EACI,CAAE,WAAU,SAAQ,QAAS,IAAW,GAEzC,CAAE,WAAU,SACpB,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EAAK,OAAO,UAAY,SAEzC,MAAO,CACN,IAFwB,YAAb,EAAyB,KAAO,KAG3C,IAAK,QAAQ,IACb,UAAW,8BAA8B,IACzC,MAAO,CAAE,KAAM,QAEjB,EACA,MAAA,CAAO,EAAM,GACZ,MAAM,EAAoB,EAAK,OAAO,UAAuB,SACvD,EAAoB,EAAK,OAAO,UAAuB,EAE7D,MAAiB,cAAb,EAIF,qCAF2B,OAAO,sCADP,EAAU,WAAa,MAK/C,GAAW,cAIT,OAAO,GAAW,aAC1B,EACA,UAAW,CAAC,CAAE,IAAK,OACnB,SAAU,CACT,KAAM,CAAC,KAAM,KAAM,KAAM,SACzB,MAAO,CAAC,OAAQ,WAAY,UAAW,OAAQ,kBAGlD,CAEA,4BAAA,CAAqC,GAC/B,KAAK,OAAO,MAAM,SAAS,eAEhC,KAAK,qBAAwB,IAC5B,GAAI,EAAQ,eAAiB,KAAK,OAAO,sBAAuB,OAEhE,MAAM,EAA6B,EAAE,OACrC,KAAM,aAAkB,aAAc,OAItC,MAAM,EAAyB,EAAO,QAAQ,IAAI,KAClD,IAAK,EAAQ,OAEb,MAAM,EAAqB,EAAO,QAAQ,iCAC1C,IAAK,EAAI,OAET,EAAE,iBAEF,MAAM,EAAqB,EAAG,aAAa,iBACtC,GAEL,EAAc,EAAS,CACtB,sBAAuB,KAAK,OAAO,sBACnC,SAAU,EAAQ,GAClB,OAAQ,KAAK,UAKf,EADuC,eAC7B,iBAAiB,YAAa,KAAK,sBAC9C,CAEA,eAAA,GACC,OAAO,EAAsB,OAAQ,GAAQ,KAAK,OAAO,MAAM,SAAS,EAAI,MAC7E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o as t,t as n,u as e}from"./Selection-HYoVFpAx.mjs";import{i as o}from"./TypeBrands-Ch9856Gb.mjs";function r(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function c(c,l){const s=r(l),a=r(l[0]??"");return{pattern:new RegExp(`(?:^|[^${a}])(${s}([^${a}\\n]+)${s})$`),handler(r,l,s,a){const i=r.selection;if(!e(i)||!t(i))return null;const u=r.getBlock(i.anchor.blockId);if(!u||"code_block"===u.type)return null;const p=l[2],d=l[1];if(!p||!d)return null;const f=a-d.length;return r.transaction("input").deleteTextAt(i.anchor.blockId,f,a).insertText(i.anchor.blockId,f,p,[{type:o(c)}]).setSelection(n(i.anchor.blockId,f+p.length)).build()}}}export{c as t};
|
|
2
|
+
//# sourceMappingURL=MarkInputRule-Bdi8KPus.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkInputRule-Bdi8KPus.mjs","names":[],"sources":["../../src/plugins/shared/MarkInputRule.ts"],"sourcesContent":["/**\n * Shared factory for live Markdown \"wrapping mark\" input rules (D6).\n *\n * Covers the three wrapping marks that share the `inline-code` rule's shape:\n * bold (`**x**`), italic (`*x*`), and strikethrough (`~~x~~`). The link rule is\n * structurally different (two capture groups, an `href`/`title` attr) and stays\n * bespoke in the link plugin. These live rules are intentionally simpler than\n * the full parser and may diverge in edge cases; the conformance bar applies to\n * full-document import/export, not live typing.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { INLINE_NODE_PLACEHOLDER, type InputRule } from '../../model/InputRule.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\n\n/** Escapes a string for safe use inside a RegExp character class / literal. */\nfunction escapeRegExp(value: string): string {\n\treturn value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Builds a live input rule that wraps `delimiter…delimiter` text in `markTypeName`.\n * The opening delimiter must not be preceded by its own first character (so `*`\n * does not fire inside `**`), and the wrapped text may not contain that\n * character or a newline (a bounded, backtracking-free pattern).\n */\nexport function createMarkInputRule(markTypeName: string, delimiter: string): InputRule {\n\tconst delim: string = escapeRegExp(delimiter);\n\tconst guard: string = escapeRegExp(delimiter[0] ?? '');\n\t// The inner run excludes the inline-node placeholder so the rule never wraps\n\t// across an inline node nor re-inserts the sentinel as literal text.\n\tconst ph: string = INLINE_NODE_PLACEHOLDER;\n\tconst pattern = new RegExp(`(?:^|[^${guard}])(${delim}([^${guard}\\\\n${ph}]+)${delim})$`);\n\n\treturn {\n\t\tpattern,\n\t\thandler(state, match, _start, end) {\n\t\t\tconst sel = state.selection;\n\t\t\tif (!isTextSelection(sel) || !isCollapsed(sel)) return null;\n\n\t\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block || block.type === 'code_block') return null;\n\n\t\t\tconst inner: string | undefined = match[2];\n\t\t\tconst expr: string | undefined = match[1];\n\t\t\tif (!inner || !expr) return null;\n\n\t\t\tconst exprStart: number = end - expr.length;\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.deleteTextAt(sel.anchor.blockId, exprStart, end)\n\t\t\t\t.insertText(sel.anchor.blockId, exprStart, inner, [{ type: markType(markTypeName) }])\n\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, exprStart + inner.length))\n\t\t\t\t.build();\n\t\t},\n\t};\n}\n"],"mappings":"yGAiBA,SAAS,EAAa,GACrB,OAAO,EAAM,QAAQ,sBAAuB,OAC7C,CAQA,SAAgB,EAAoB,EAAsB,GACzD,MAAM,EAAgB,EAAa,GAC7B,EAAgB,EAAa,EAAU,IAAM,IAMnD,MAAO,CACN,QAAA,IAHmB,OAAO,UAAU,OAAW,OAAW,WAAmB,OAI7E,OAAA,CAAQ,EAAO,EAAO,EAAQ,GAC7B,MAAM,EAAM,EAAM,UAClB,IAAK,EAAgB,KAAS,EAAY,GAAM,OAAO,KAEvD,MAAM,EAA+B,EAAM,SAAS,EAAI,OAAO,SAC/D,IAAK,GAAwB,eAAf,EAAM,KAAuB,OAAO,KAElD,MAAM,EAA4B,EAAM,GAClC,EAA2B,EAAM,GACvC,IAAK,IAAU,EAAM,OAAO,KAE5B,MAAM,EAAoB,EAAM,EAAK,OACrC,OAAO,EACL,YAAY,SACZ,aAAa,EAAI,OAAO,QAAS,EAAW,GAC5C,WAAW,EAAI,OAAO,QAAS,EAAW,EAAO,CAAC,CAAE,KAAM,EAAS,MACnE,aAAa,EAAyB,EAAI,OAAO,QAAS,EAAY,EAAM,SAC5E,OACH,EAEF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as t,s as e}from"./HTMLUtils-Bhg3_P8B.mjs";import{l as n,n as r,o as i,r as s}from"./TableDimensions-BBhjHNjQ.mjs";import{t as o}from"./SchemaRegistry-CkBN-1yW.mjs";var a=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/;function c(t){let e=t.trim();e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&!e.endsWith("\\|")&&(e=e.slice(0,-1));const n=[];let r="";for(let i=0;i<e.length;i++){const t=e[i]??"";"\\"!==t||"|"!==e[i+1]?"|"!==t?r+=t:(n.push(r.trim()),r=""):(r+="|",i++)}return n.push(r.trim()),n}function l(t){const e=t.trim(),n=e.startsWith(":"),r=e.endsWith(":");return n&&r?"center":r?"end":n?"start":null}function u(t,e,n){const r=t[e]??"",i=t[e+1]??"";if(!r.includes("|"))return null;if(!a.test(i))return null;const s=c(r),o=c(i).map(l);if(o.length!==s.length)return null;const u=[];let g=e+2;for(;g<t.length;){const e=t[g]??"";if(""===e.trim())break;if(!e.includes("|")&&(!n||n(e)))break;u.push(c(e)),g++}return{aligns:o,header:s,rows:u,linesConsumed:g-e}}var g=/[!-/:-@[-`{-~]/,h=/&(#[xX][0-9a-fA-F]{1,6}|#[0-9]{1,7}|[a-zA-Z][a-zA-Z0-9]{1,31});/y,f={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",copy:"©",reg:"®",hellip:"…",mdash:"—",ndash:"–"};function p(t){if("#"===t[0]){const e="x"===t[1]||"X"===t[1],n=Number.parseInt(t.slice(e?2:1),e?16:10);if(!Number.isFinite(n)||n<0||n>1114111)return`&${t};`;if(0===n)return"�";try{const t=String.fromCodePoint(n);return"\n"===t||"\r"===t?" ":t}catch{return"�"}}return f[t]??function(t){if("undefined"==typeof document)return null;const e=m.get(t);if(void 0!==e)return e;const n=document.createElement("div");n.innerHTML=`&${t};`;const r=n.textContent??"",i=""!==r&&r!==`&${t};`?r:null;return m.set(t,i),i}(t)??`&${t};`}function d(t,e){return h.lastIndex=e,h.exec(t)}var m=/* @__PURE__ */new Map;function b(t){let e="",n=0;for(;n<t.length;){const r=t[n]??"";if("\\"===r&&g.test(t[n+1]??""))e+=t[n+1],n+=2;else{if("&"===r){const r=d(t,n);if(r?.[1]){e+=p(r[1]),n+=r[0].length;continue}}e+=r,n++}}return e}function $(t){let e="",n=0;for(;n<t.length;){const r=t[n]??"";if("&"===r){const r=d(t,n);if(r?.[1]){e+=p(r[1]),n+=r[0].length;continue}}e+=r,n++}return e}var y,k=new Set(["address","article","aside","blockquote","details","div","dl","dd","dt","figure","figcaption","footer","form","h1","h2","h3","h4","h5","h6","header","hr","iframe","main","nav","ol","p","pre","section","table","tbody","td","tfoot","th","thead","tr","ul","video"]),M=/^ {0,3}(#{1,6})(?:[ \t]+(.*?))?(?:[ \t]+#+)?[ \t]*$/,T=/^ {0,3}(`{3,}|~{3,})[ \t]*(.*)$/,S=/^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/,x=/^ {0,3}>[ ]?/,L=/^([ \t]*)([-*+])(?:([ \t]+)(.*))?$/,H=/^([ \t]*)(\d{1,9})([.)])(?:([ \t]+)(.*))?$/,w=/^\[([ xX])\][ \t]+(.*)$/,N=/^ {0,3}=+[ \t]*$/,z=/^ {0,3}-+[ \t]*$/,A=/^ {0,3}<(\/?)([a-zA-Z][a-zA-Z0-9-]*)|^ {0,3}<!--/;function v(t){return""===t.trim()}function D(t){const e=t.match(T);return e?"`"===(e[1]??"")[0]&&(e[2]??"").includes("`")?null:e:null}function O(t,e=!0,n=[]){return _(t.replace(/\r\n?/g,"\n").replace(/\n$/,"").split("\n"),e,n)}function _(t,e,n,r=0){const i=[];let s=0;for(;s<t.length;){const o=t[s]??"";if(v(o)){s++;continue}const a=P(n,t,s,i);if(a>0){s+=a;continue}if(e){const e=u(t,s,J);if(e){i.push({type:"table",aligns:e.aligns,header:e.header,rows:e.rows}),s+=e.linesConsumed;continue}}const c=D(o);if(c){s=C(t,s,c,i);continue}const l=o.match(M);if(l){const t=(l[2]??"").trim(),e=/^#+$/.test(t)?"":t;i.push({type:"heading",level:(l[1]??"#").length,text:e}),s++;continue}if(S.test(o)){i.push({type:"hr"}),s++;continue}if(x.test(o)){if(r>=32){s=K(t,s,i);continue}s=R(t,s,i,e,n,r);continue}const g=r<32?X(o):null;s=g?V(t,s,g,i,e,n,r):j(o)?I(t,s,i):U(o)?G(t,s,i):K(t,s,i)}return i}function C(t,e,n,r){const i=n[1]??"```",s=i[0]??"`",o=b((n[2]??"").trim().split(/\s+/)[0]??""),a=new RegExp(`^ {0,3}\\${s}{${i.length},}[ \\t]*$`),c=t[e]??"",l=c.length-c.trimStart().length,u=[];let g=e+1;for(;g<t.length;){const e=t[g]??"";if(a.test(e)){g++;break}u.push(q(e,l)),g++}return r.push({type:"code_block",language:o,code:u.join("\n")}),g}function q(t,e){let n=0;for(;n<e&&" "===t[n];)n++;return t.slice(n)}function j(t){return W(t)>=4}function W(t){let e=0;for(const n of t)if(" "===n)e++;else{if("\t"!==n)break;e+=4-e%4}return e}function E(t,e){let n=0,r=0;for(;r<t.length;){const e=t[r]??"";if(" "===e)n++;else{if("\t"!==e)break;n+=4-n%4}r++}return" ".repeat(Math.max(0,n-e))+t.slice(r)}function F(t,e){let n=0,r=0;for(;r<t.length&&n<e;){const i=t[r]??"";if(" "===i)n++,r++;else{if("\t"!==i)break;{const i=n+4-n%4;if(i>e)return" ".repeat(i-e)+t.slice(r+1);n=i,r++}}}return t.slice(r)}function I(t,e,n){const r=[],i=[];let s=e;for(;s<t.length;){const e=t[s]??"";if(v(e))i.push(F(e,4)),s++;else{if(W(e)<4)break;for(;i.length>0;)r.push(i.shift()??"");r.push(F(e,4)),s++}}return n.push({type:"code_block",language:"",code:r.join("\n")}),s-i.length}function P(t,e,n,r){for(const i of t){const t=i.matchBlock?.(e,n);if(t&&t.linesConsumed>0)return r.push({type:"extension_block",nodeType:t.type,attrs:t.attrs}),t.linesConsumed}return 0}function R(t,e,n,r,i,s){const o=[];let a=e,c=!1;for(;a<t.length;){const e=t[a]??"";if(x.test(e)){const t=e.replace(x,"");o.push(t),c=Z(t),a++;continue}if(!c||v(e)||J(e)||r&&u(t,a,J))break;o.push(e),a++}return n.push({type:"blockquote",children:_(o,r,i,s+1)}),a}function Z(t){let e=t;for(;;){if(x.test(e)){e=e.replace(x,"");continue}const t=X(e);if(!t||""===t.firstText)break;e=t.firstText}return""!==e.trim()&&!J(e)&&W(e)<4}function X(t){const e=t.match(L),n=e?null:t.match(H),r=e??n;if(!r)return null;const i=W(r[1]??"");if(i>3)return null;const s=i+((e?r[2]:`${r[2]}${r[3]}`)??"-").length,o=function(t,e){let n=t;for(const r of e)if(" "===r)n++;else{if("\t"!==r)break;n+=4-n%4}return n-t}(s,(e?r[3]:r[4])??""),a=(e?r[4]:r[5])??"",c=n?Number.parseInt(r[2]??"1",10):1;let l,u;""===a.trim()?(l=s+1,u=""):o>=5?(l=s+1,u=" ".repeat(o-1)+a):(l=s+o,u=a);const g=u.match(w);return g?{listType:"checklist",checked:"x"===(g[1]??" ").toLowerCase(),contentColumn:l,firstText:g[2]??"",startNumber:c}:{listType:n?"ordered":"bullet",checked:!1,contentColumn:l,firstText:u,startNumber:c}}function V(t,e,n,r,i,s,o){const a=[],c=function(){let t=null;return(e,n)=>{if(t)return t.test(e)&&(t=null),!1;const r=D(e);if(r){const e=r[1]??"```",n=e[0]??"`";return t=new RegExp(`^ {0,3}\\${n}{${e.length},}[ \\t]*$`),!1}return!v(e)&&(x.test(e)||X(e)?Z(e):W(e)>=4?n:!J(e))}}();let l=n.firstText,g=""!==l&&c(l,!1),h=0,f=e+1;for(;f<t.length;){const e=t[f]??"";if(v(e)){if(""===l&&0===a.length)break;h++,g=!1,f++;continue}if(W(e)>=n.contentColumn){for(;h>0;)a.push(""),h--;const t=E(e,n.contentColumn);a.push(t),g=c(t,g),f++;continue}if(X(e))break;if(!g)break;if(J(e))break;if(i&&u(t,f,J))break;const r=e.trimStart(),s=a[a.length-1];void 0!==s?a[a.length-1]=`${s}\n${r}`:l=""===l?r:`${l}\n${r}`,g=c(r,g),f++}return function(t,e,n,r,i,s,o){const a=""===e?[...n]:[e,...n],c=0===a.length?[]:_(a,i,s,o+1),l=[],u=[];for(const h of c)"list_item"===h.type?l.push({...h,indent:h.indent+1}):u.push(h);const g=u[0];1===u.length&&"paragraph"===g?.type?r.push(B(t,g.text)):0===u.length?r.push(B(t,"")):r.push(B(t,"",u)),r.push(...l)}(n,l,a,r,i,s,o),f}function B(t,e,n){const r={type:"list_item",listType:t.listType,indent:0,checked:t.checked,text:e};return n?{...r,children:n}:r}function U(t){const e=t.match(A);if(!e)return!1;if(t.trimStart().startsWith("\x3c!--"))return!0;const n=(e[2]??"").toLowerCase();return k.has(n)}function G(t,e,n){const r=[];let i=e;for(;i<t.length;){const e=t[i]??"";if(v(e))break;r.push(e),i++}return n.push({type:"html",html:r.join("\n")}),i}function J(t){return!!(v(t)||M.test(t)||D(t)||S.test(t)||x.test(t)||function(t){const e=X(t);return!!e&&""!==e.firstText.trim()&&("ordered"!==e.listType||1===e.startNumber)}(t)||U(t))}function K(t,e,n){const r=[t[e]??""];let i=e+1;for(;i<t.length;){const e=t[i]??"";if(N.test(e))return n.push({type:"heading",level:1,text:Y(r)}),i+1;if(z.test(e))return n.push({type:"heading",level:2,text:Y(r)}),i+1;if(J(e))break;r.push(e),i++}return n.push({type:"paragraph",text:Q(r)}),i}function Q(t){return t.map((e,n)=>n===t.length-1?e.trim():e.trimStart()).join("\n")}function Y(t){return t.map(t=>t.trim()).join(" ").trim()}function tt(a){return a||(y??=function(){const a=new o;return function(e){e.registerNodeSpec({type:"paragraph",toDOM:et,toHTML:(t,e)=>`<p>${e||"<br>"}</p>`,parseHTML:[{tag:"p"},{tag:"div",priority:10}],sanitize:{tags:["p"]}}),e.registerNodeSpec({type:"heading",toDOM:et,toHTML(t,e){const n=t.attrs?.level,r="number"==typeof n&&Number.isFinite(n)?Math.max(1,Math.min(6,Math.floor(n))):1;return`<h${r}>${e||"<br>"}</h${r}>`},parseHTML:[1,2,3,4,5,6].map(t=>({tag:`h${t}`,getAttrs:()=>({level:t})})),sanitize:{tags:["h1","h2","h3","h4","h5","h6"]}}),e.registerNodeSpec({type:"list_item",toDOM:et,toHTML(t,e){if("checklist"!==t.attrs?.listType)return`<li>${e||"<br>"}</li>`;const n=!0===t.attrs.checked;return`<li role="checkbox" aria-checked="${String(n)}"><input type="checkbox" disabled${n?" checked":""}>${e||"<br>"}</li>`},parseHTML:[{tag:"li"}],sanitize:{tags:["ul","ol","li","input"],attrs:["type","disabled","checked","role","aria-checked"]}}),e.registerNodeSpec({type:"blockquote",toDOM:et,toHTML:(t,e)=>`<blockquote>${e||"<br>"}</blockquote>`,parseHTML:[{tag:"blockquote"}],sanitize:{tags:["blockquote"]}}),e.registerNodeSpec({type:"code_block",toDOM:et,toHTML(e,n){const r=String(e.attrs?.language??"");return`<pre><code${r?` class="language-${t(r)}"`:""}>${n}</code></pre>`},parseHTML:[{tag:"pre",getAttrs:t=>({language:t.querySelector("code")?.className.match(/(?:^|\s)language-(\S+)/)?.[1]??""})}],sanitize:{tags:["pre","code"],attrs:["class"]}}),e.registerNodeSpec({type:"horizontal_rule",isVoid:!0,toDOM:et,toHTML:()=>"<hr>",parseHTML:[{tag:"hr"}],sanitize:{tags:["hr"]}}),e.registerNodeSpec({type:"image",isVoid:!0,attrs:{src:{default:""},alt:{default:""},title:{default:""},align:{default:"center"}},toDOM:et,toHTML(e){const n=t(String(e.attrs?.src??"")),r=t(String(e.attrs?.alt??"")),i=String(e.attrs?.title??""),s=(t,e)=>"number"==typeof e&&Number.isFinite(e)&&e>0?` ${t}="${String(e)}"`:"";return`<figure><img src="${n}" alt="${r}"${i?` title="${t(i)}"`:""}${s("width",e.attrs?.width)}${s("height",e.attrs?.height)}></figure>`},parseHTML:[{tag:"figure",getAttrs(t){const e=t.querySelector("img");return!!e&&nt(e)}},{tag:"img",getAttrs:t=>nt(t)}],sanitize:{tags:["figure","img"],attrs:["src","alt","title","width","height"]}}),e.registerNodeSpec({type:"table",toDOM:et,toHTML(t,e,s){const o=i(t.attrs?.columnWidthsPx),a=o?`<colgroup>${o.map(t=>`<col${n(r,"width",t,s)}>`).join("")}</colgroup>`:"";return`<table${o?function(t,e){const n=t.reduce((t,e)=>t+(e??60),0),r=t.every(t=>null!==t)?`width: ${String(n)}px; min-width: ${String(n)}px; table-layout: fixed`:`width: 100%; min-width: ${String(n)}px; table-layout: fixed`;return e?.styleAttr(r)??` style="${r}"`}(o,s):""}>${a}<tbody>${e}</tbody></table>`},sanitize:{tags:["table","colgroup","col","thead","tbody","tfoot"],attrs:["span","width",r]}}),e.registerNodeSpec({type:"table_row",toDOM:et,toHTML:(t,e,r)=>`<tr${n(s,"height",t.attrs?.minHeightPx,r)}>${e}</tr>`,sanitize:{tags:["tr"],attrs:["height",s]}}),e.registerNodeSpec({type:"table_cell",toDOM:et,toHTML(t,e){const n=(t,e)=>"number"==typeof e&&Number.isInteger(e)&&e>1?` ${t}="${String(e)}"`:"";return`<td${n("colspan",t.attrs?.colspan)}${n("rowspan",t.attrs?.rowspan)}>${e}</td>`},sanitize:{tags:["td","th"],attrs:["colspan","rowspan"]}})}(a),function(n){for(const t of[{type:"bold",rank:0,tag:"strong",parseTags:["strong","b"]},{type:"italic",rank:1,tag:"em",parseTags:["em","i"]},{type:"underline",rank:2,tag:"u",parseTags:["u"]},{type:"code",rank:3,tag:"code",parseTags:["code"]},{type:"strikethrough",rank:4,tag:"s",parseTags:["s","strike","del"]}])n.registerMarkSpec({type:t.type,rank:t.rank,toDOM:et,toHTMLString:(e,n)=>`<${t.tag}>${n}</${t.tag}>`,parseHTML:t.parseTags.map(t=>({tag:t,getAttrs:"code"===t?t=>"PRE"!==t.parentElement?.tagName&&{}:void 0})),sanitize:{tags:t.parseTags}});n.registerMarkSpec({type:"link",rank:10,toDOM:et,toHTMLString(n,r){const i=t(e(String(n.attrs?.href??""))),s=String(n.attrs?.title??"");return`<a href="${i}"${s?` title="${t(s)}"`:""}>${r}</a>`},parseHTML:[{tag:"a",getAttrs(t){const n=e(t.getAttribute("href")??""),r=t.getAttribute("title");return r?{href:n,title:r}:{href:n}}}],sanitize:{tags:["a"],attrs:["href","title"]}})}(a),function(e){e.registerInlineNodeSpec({type:"hard_break",toDOM:et,toHTMLString:()=>"<br>",parseHTML:[{tag:"br"}],sanitize:{tags:["br"]}}),e.registerInlineNodeSpec({type:"image_inline",toDOM:et,toHTMLString(e){const n=t(String(e.attrs.src??"")),r=t(String(e.attrs.alt??"")),i=String(e.attrs.title??"");return`<img src="${n}" alt="${r}"${i?` title="${t(i)}"`:""}>`},parseHTML:[{tag:"img",getAttrs:t=>rt(t)}],sanitize:{tags:["img"],attrs:["src","alt","title"]}})}(a),a}(),y)}function et(){throw new Error("The Markdown HTML registry cannot render editor DOM.")}function nt(t){const e={...rt(t),align:"center"};for(const n of["width","height"]){const r=Number.parseFloat(t.getAttribute(n)??"");Number.isFinite(r)&&r>0&&(e[n]=r)}return e}function rt(t){const e={src:t.getAttribute("src")??"",alt:t.getAttribute("alt")??""},n=t.getAttribute("title");return n&&(e.title=n),e}export{z as a,O as c,b as d,d as f,N as i,$ as l,M as n,S as o,T as r,D as s,tt as t,p as u};
|
|
2
|
+
//# sourceMappingURL=MarkdownHTMLRegistry-Q7l0d6Ma.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownHTMLRegistry-Q7l0d6Ma.mjs","names":[],"sources":["../../src/serialization/markdown/GfmTableParser.ts","../../src/serialization/markdown/MarkdownEntities.ts","../../src/serialization/markdown/BlockTokenizer.ts","../../src/serialization/markdown/MarkdownHTMLRegistry.ts"],"sourcesContent":["/**\n * GFM table detection and row parsing.\n *\n * A table is a header row, a delimiter row (`| --- | :--: |`), and zero or more\n * body rows. Column alignment is derived from the colons in the delimiter row.\n * Cells hold raw inline text, parsed later by the inline tokenizer.\n */\n\n/** Column alignment derived from the delimiter row. */\nexport type ColumnAlign = 'start' | 'center' | 'end' | null;\n\n/** A parsed GFM table (cells are raw inline strings). */\nexport interface TableData {\n\treadonly aligns: readonly ColumnAlign[];\n\treadonly header: readonly string[];\n\treadonly rows: readonly (readonly string[])[];\n\treadonly linesConsumed: number;\n}\n\nconst DELIMITER_ROW = /^\\s*\\|?\\s*:?-+:?\\s*(\\|\\s*:?-+:?\\s*)*\\|?\\s*$/;\n\n/** Splits a table row into trimmed cells, honoring escaped `\\|` and outer pipes. */\nfunction splitRow(line: string): string[] {\n\tlet s: string = line.trim();\n\tif (s.startsWith('|')) s = s.slice(1);\n\tif (s.endsWith('|') && !s.endsWith('\\\\|')) s = s.slice(0, -1);\n\n\tconst cells: string[] = [];\n\tlet current = '';\n\tfor (let i = 0; i < s.length; i++) {\n\t\tconst ch: string = s[i] ?? '';\n\t\tif (ch === '\\\\' && s[i + 1] === '|') {\n\t\t\tcurrent += '|';\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === '|') {\n\t\t\tcells.push(current.trim());\n\t\t\tcurrent = '';\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += ch;\n\t}\n\tcells.push(current.trim());\n\treturn cells;\n}\n\n/** Reads the alignment of a single delimiter cell (`:--`, `--:`, `:-:`, `--`). */\nfunction cellAlign(cell: string): ColumnAlign {\n\tconst trimmed: string = cell.trim();\n\tconst left: boolean = trimmed.startsWith(':');\n\tconst right: boolean = trimmed.endsWith(':');\n\tif (left && right) return 'center';\n\tif (right) return 'end';\n\tif (left) return 'start';\n\treturn null;\n}\n\n/**\n * Attempts to parse a GFM table beginning at `start`. Returns the table data or\n * null when the two leading lines are not a header + delimiter pair. The body\n * extends until a blank line or the start of another block (`interrupts`); a\n * plain paragraph-like line inside that range is a lazy single-cell row, per\n * the GFM spec (\"the table is broken at the first empty line or beginning of\n * another block-level structural element\").\n */\nexport function matchTable(\n\tlines: readonly string[],\n\tstart: number,\n\tinterrupts?: (line: string) => boolean,\n): TableData | null {\n\tconst headerLine: string = lines[start] ?? '';\n\tconst delimLine: string = lines[start + 1] ?? '';\n\tif (!headerLine.includes('|')) return null;\n\tif (!DELIMITER_ROW.test(delimLine)) return null;\n\n\tconst header: string[] = splitRow(headerLine);\n\tconst aligns: ColumnAlign[] = splitRow(delimLine).map(cellAlign);\n\tif (aligns.length !== header.length) return null;\n\n\tconst rows: string[][] = [];\n\tlet i: number = start + 2;\n\twhile (i < lines.length) {\n\t\tconst line: string = lines[i] ?? '';\n\t\tif (line.trim() === '') break;\n\t\tif (!line.includes('|') && (!interrupts || interrupts(line))) break;\n\t\trows.push(splitRow(line));\n\t\ti++;\n\t}\n\n\treturn { aligns, header, rows, linesConsumed: i - start };\n}\n","/**\n * HTML entity and backslash-escape decoding shared by the Markdown parser.\n *\n * CommonMark recognizes entity and numeric character references (and backslash\n * escapes) not only in inline text but also inside link destinations, link\n * titles, link reference definitions, and code-fence info strings. The small\n * built-in table covers the common names; uncommon names are decoded through\n * the environment's HTML parser when a DOM is available (browser, happy-dom),\n * because embedding the full HTML5 table (~2200 names) would bloat the chunk.\n * Without a DOM (pure Node) unknown entities stay literal, which never loses\n * content.\n */\n\n/** Characters a backslash may escape (CommonMark ASCII punctuation). */\nexport const ESCAPABLE = /[!-/:-@[-`{-~]/;\n\n/** Sticky matcher so callers scan at an index without slicing (linear-time, D1). */\nconst ENTITY_AT = /&(#[xX][0-9a-fA-F]{1,6}|#[0-9]{1,7}|[a-zA-Z][a-zA-Z0-9]{1,31});/y;\n\nconst NAMED_ENTITIES: Readonly<Record<string, string>> = {\n\tamp: '&',\n\tlt: '<',\n\tgt: '>',\n\tquot: '\"',\n\tapos: \"'\",\n\tnbsp: ' ',\n\tcopy: '©',\n\treg: '®',\n\thellip: '…',\n\tmdash: '—',\n\tndash: '–',\n};\n\n/**\n * Decodes a single HTML entity body (without `&`/`;`), or returns it verbatim.\n * Per CommonMark, U+0000 and invalid code points decode to U+FFFD; decoded\n * line separators become plain spaces so a text node never carries a raw\n * newline (block boundaries are structural in the editor model).\n */\nexport function decodeEntity(body: string): string {\n\tif (body[0] === '#') {\n\t\tconst isHex: boolean = body[1] === 'x' || body[1] === 'X';\n\t\tconst code: number = Number.parseInt(body.slice(isHex ? 2 : 1), isHex ? 16 : 10);\n\t\tif (!Number.isFinite(code) || code < 0 || code > 0x10ffff) return `&${body};`;\n\t\tif (code === 0) return '�';\n\t\ttry {\n\t\t\tconst decoded: string = String.fromCodePoint(code);\n\t\t\treturn decoded === '\\n' || decoded === '\\r' ? ' ' : decoded;\n\t\t} catch {\n\t\t\treturn '�';\n\t\t}\n\t}\n\treturn NAMED_ENTITIES[body] ?? decodeNamedEntityViaDom(body) ?? `&${body};`;\n}\n\n/** Matches an entity reference at `pos` in `text`, or null. */\nexport function matchEntityAt(text: string, pos: number): RegExpExecArray | null {\n\tENTITY_AT.lastIndex = pos;\n\treturn ENTITY_AT.exec(text);\n}\n\nconst domEntityCache = new Map<string, string | null>();\n\nfunction decodeNamedEntityViaDom(body: string): string | null {\n\tif (typeof document === 'undefined') return null;\n\tconst cached: string | null | undefined = domEntityCache.get(body);\n\tif (cached !== undefined) return cached;\n\t// `body` is regex-restricted to alphanumerics, so this cannot inject markup.\n\tconst holder: HTMLElement = document.createElement('div');\n\tholder.innerHTML = `&${body};`;\n\tconst text: string = holder.textContent ?? '';\n\tconst decoded: string | null = text !== '' && text !== `&${body};` ? text : null;\n\tdomEntityCache.set(body, decoded);\n\treturn decoded;\n}\n\n/**\n * Decodes backslash escapes and entity references in a single left-to-right\n * pass (an escaped `&` therefore never starts an entity). Used for the string\n * contexts CommonMark decodes outside inline text: link destinations, titles,\n * reference definitions, and fence info strings.\n */\nexport function decodeEscapesAndEntities(text: string): string {\n\tlet out = '';\n\tlet i = 0;\n\twhile (i < text.length) {\n\t\tconst ch: string = text[i] ?? '';\n\t\tif (ch === '\\\\' && ESCAPABLE.test(text[i + 1] ?? '')) {\n\t\t\tout += text[i + 1];\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === '&') {\n\t\t\tconst match: RegExpExecArray | null = matchEntityAt(text, i);\n\t\t\tif (match?.[1]) {\n\t\t\t\tout += decodeEntity(match[1]);\n\t\t\t\ti += match[0].length;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tout += ch;\n\t\ti++;\n\t}\n\treturn out;\n}\n\n/** Decodes only entity references (escapes were already consumed by the caller). */\nexport function decodeEntitiesOnly(text: string): string {\n\tlet out = '';\n\tlet i = 0;\n\twhile (i < text.length) {\n\t\tconst ch: string = text[i] ?? '';\n\t\tif (ch === '&') {\n\t\t\tconst match: RegExpExecArray | null = matchEntityAt(text, i);\n\t\t\tif (match?.[1]) {\n\t\t\t\tout += decodeEntity(match[1]);\n\t\t\t\ti += match[0].length;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tout += ch;\n\t\ti++;\n\t}\n\treturn out;\n}\n","/**\n * Block-level Markdown tokenizer.\n *\n * A line scanner that turns Markdown source into a flat (recursive for\n * blockquotes) list of block tokens. The grammar is centralized here, by\n * necessity: CommonMark block structure is global and context-sensitive and\n * cannot be decomposed into per-spec rules (D4). `MarkdownParser` maps these\n * tokens to schema node types by name.\n *\n * List items follow CommonMark content-column semantics (#194): each item owns\n * a content column derived from its marker; subsequent lines indented at least\n * that far are the item's own content region, dedented and tokenized\n * recursively. A region that yields a single paragraph keeps the item a leaf;\n * anything else makes the item a container with block children. Nested list\n * items are hoisted out of the region into flat siblings (the editor's\n * flat-with-indent sibling model, indent = nesting level). Markers indented\n * four or more columns are not markers (indented code / lazy text, per spec).\n * Blockquotes support lazy paragraph continuation, and so do list items.\n */\n\nimport type { MarkdownSyntaxExtension } from '../../model/MarkdownSyntaxRegistry.js';\nimport { type ColumnAlign, type TableData, matchTable } from './GfmTableParser.js';\nimport { decodeEscapesAndEntities } from './MarkdownEntities.js';\n\n/** A parsed block-level token. Inline text is left raw for the inline parser. */\nexport type BlockToken =\n\t| { readonly type: 'heading'; readonly level: number; readonly text: string }\n\t| { readonly type: 'paragraph'; readonly text: string }\n\t| { readonly type: 'code_block'; readonly language: string; readonly code: string }\n\t| { readonly type: 'hr' }\n\t| { readonly type: 'blockquote'; readonly children: readonly BlockToken[] }\n\t| {\n\t\t\treadonly type: 'list_item';\n\t\t\treadonly listType: 'bullet' | 'ordered' | 'checklist';\n\t\t\treadonly indent: number;\n\t\t\treadonly checked: boolean;\n\t\t\t/** Inline text of a leaf item; empty when `children` is present. */\n\t\t\treadonly text: string;\n\t\t\t/** Block children of a multi-block (container) item, absent for leaves. */\n\t\t\treadonly children?: readonly BlockToken[];\n\t }\n\t| { readonly type: 'html'; readonly html: string }\n\t| {\n\t\t\treadonly type: 'table';\n\t\t\treadonly aligns: readonly ColumnAlign[];\n\t\t\treadonly header: readonly string[];\n\t\t\treadonly rows: readonly (readonly string[])[];\n\t }\n\t| {\n\t\t\treadonly type: 'extension_block';\n\t\t\treadonly nodeType: string;\n\t\t\treadonly attrs: Record<string, string | number | boolean>;\n\t };\n\n/** Block-level HTML tags that begin an HTML block; inline tags fall through to paragraphs. */\nconst BLOCK_HTML_TAGS: ReadonlySet<string> = new Set([\n\t'address',\n\t'article',\n\t'aside',\n\t'blockquote',\n\t'details',\n\t'div',\n\t'dl',\n\t'dd',\n\t'dt',\n\t'figure',\n\t'figcaption',\n\t'footer',\n\t'form',\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'header',\n\t'hr',\n\t'iframe',\n\t'main',\n\t'nav',\n\t'ol',\n\t'p',\n\t'pre',\n\t'section',\n\t'table',\n\t'tbody',\n\t'td',\n\t'tfoot',\n\t'th',\n\t'thead',\n\t'tr',\n\t'ul',\n\t'video',\n]);\n\n// Exported so the parser's link-reference pre-pass can reuse the exact grammar\n// when deciding block boundaries (single source of truth for the syntax).\nexport const ATX_HEADING = /^ {0,3}(#{1,6})(?:[ \\t]+(.*?))?(?:[ \\t]+#+)?[ \\t]*$/;\nexport const FENCE_OPEN = /^ {0,3}(`{3,}|~{3,})[ \\t]*(.*)$/;\nexport const THEMATIC_BREAK = /^ {0,3}([-*_])[ \\t]*(?:\\1[ \\t]*){2,}$/;\nconst BLOCKQUOTE = /^ {0,3}>[ ]?/;\nconst BULLET_ITEM = /^([ \\t]*)([-*+])(?:([ \\t]+)(.*))?$/;\nconst ORDERED_ITEM = /^([ \\t]*)(\\d{1,9})([.)])(?:([ \\t]+)(.*))?$/;\nconst TASK_PREFIX = /^\\[([ xX])\\][ \\t]+(.*)$/;\n// Exported alongside the other grammar patterns so the serializer's line-start\n// escaping re-parses paragraph lines with the exact same rules (single source of\n// truth: a line the tokenizer would read as a setext underline gets escaped).\nexport const SETEXT_H1 = /^ {0,3}=+[ \\t]*$/;\nexport const SETEXT_H2 = /^ {0,3}-+[ \\t]*$/;\nconst HTML_BLOCK_START = /^ {0,3}<(\\/?)([a-zA-Z][a-zA-Z0-9-]*)|^ {0,3}<!--/;\n\n/** Leading-whitespace columns that open an indented code block (CommonMark). */\nconst INDENTED_CODE_COLUMNS = 4;\n\n/** Maximum leading columns of a list marker; deeper markers are code/lazy text. */\nconst MAX_MARKER_INDENT_COLUMNS = 3;\n\n/**\n * Maximum container nesting (blockquotes, list-item regions) before the\n * construct is treated as literal text. Each level recurses\n * (`tokenizeLines` → container consumer → `tokenizeLines`), so an adversarial\n * paste of thousands of `>`/`-` prefixes would overflow the stack. The cap\n * keeps recursion bounded; deeper content degrades to a paragraph (no data\n * loss, the marker characters are preserved). Real documents never nest this\n * deep.\n */\nconst MAX_CONTAINER_DEPTH = 32;\n\nfunction isBlank(line: string): boolean {\n\treturn line.trim() === '';\n}\n\n/**\n * Matches a fence opener. A backtick fence whose info string contains a\n * backtick is not a fence per CommonMark (it reads as an inline code span).\n */\nexport function matchFenceOpen(line: string): RegExpMatchArray | null {\n\tconst match: RegExpMatchArray | null = line.match(FENCE_OPEN);\n\tif (!match) return null;\n\tif ((match[1] ?? '')[0] === '`' && (match[2] ?? '').includes('`')) return null;\n\treturn match;\n}\n\n/** Tokenizes a full Markdown source string into block tokens. */\nexport function tokenizeBlocks(\n\tsource: string,\n\tgfm = true,\n\textensions: readonly MarkdownSyntaxExtension[] = [],\n): BlockToken[] {\n\t// A single trailing newline closes the last line; it is not an extra line\n\t// (otherwise an unclosed fence at EOF would gain a phantom blank line).\n\tconst normalized: string = source.replace(/\\r\\n?/g, '\\n').replace(/\\n$/, '');\n\treturn tokenizeLines(normalized.split('\\n'), gfm, extensions);\n}\n\nfunction tokenizeLines(\n\tlines: readonly string[],\n\tgfm: boolean,\n\textensions: readonly MarkdownSyntaxExtension[],\n\tdepth = 0,\n): BlockToken[] {\n\tconst tokens: BlockToken[] = [];\n\tlet i = 0;\n\n\twhile (i < lines.length) {\n\t\tconst line: string = lines[i] ?? '';\n\n\t\tif (isBlank(line)) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst extension: number = tryExtensionBlock(extensions, lines, i, tokens);\n\t\tif (extension > 0) {\n\t\t\ti += extension;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (gfm) {\n\t\t\tconst table: TableData | null = matchTable(lines, i, interruptsParagraph);\n\t\t\tif (table) {\n\t\t\t\ttokens.push({\n\t\t\t\t\ttype: 'table',\n\t\t\t\t\taligns: table.aligns,\n\t\t\t\t\theader: table.header,\n\t\t\t\t\trows: table.rows,\n\t\t\t\t});\n\t\t\t\ti += table.linesConsumed;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tconst fence: RegExpMatchArray | null = matchFenceOpen(line);\n\t\tif (fence) {\n\t\t\ti = consumeFencedCode(lines, i, fence, tokens);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst atx: RegExpMatchArray | null = line.match(ATX_HEADING);\n\t\tif (atx) {\n\t\t\tconst rawText: string = (atx[2] ?? '').trim();\n\t\t\t// Content that is only `#`s is a closing sequence, not text (`### ###`).\n\t\t\tconst text: string = /^#+$/.test(rawText) ? '' : rawText;\n\t\t\ttokens.push({ type: 'heading', level: (atx[1] ?? '#').length, text });\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (THEMATIC_BREAK.test(line)) {\n\t\t\ttokens.push({ type: 'hr' });\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (BLOCKQUOTE.test(line)) {\n\t\t\t// Depth guard: past the cap, stop recursing and keep the `>` lines as\n\t\t\t// literal paragraph text rather than overflowing the stack.\n\t\t\tif (depth >= MAX_CONTAINER_DEPTH) {\n\t\t\t\ti = consumeParagraph(lines, i, tokens);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ti = consumeBlockquote(lines, i, tokens, gfm, extensions, depth);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst marker: ListMarker | null = depth < MAX_CONTAINER_DEPTH ? matchListMarker(line) : null;\n\t\tif (marker) {\n\t\t\ti = consumeListItem(lines, i, marker, tokens, gfm, extensions, depth);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (canStartIndentedCode(line)) {\n\t\t\ti = consumeIndentedCode(lines, i, tokens);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isHtmlBlockStart(line)) {\n\t\t\ti = consumeHtmlBlock(lines, i, tokens);\n\t\t\tcontinue;\n\t\t}\n\n\t\ti = consumeParagraph(lines, i, tokens);\n\t}\n\n\treturn tokens;\n}\n\n/** Consumes a fenced code block; returns the next line index. */\nfunction consumeFencedCode(\n\tlines: readonly string[],\n\tstart: number,\n\tfence: RegExpMatchArray,\n\ttokens: BlockToken[],\n): number {\n\tconst fenceStr: string = fence[1] ?? '```';\n\tconst fenceChar: string = fenceStr[0] ?? '`';\n\tconst language: string = decodeEscapesAndEntities((fence[2] ?? '').trim().split(/\\s+/)[0] ?? '');\n\tconst closeRe = new RegExp(`^ {0,3}${`\\\\${fenceChar}`}{${fenceStr.length},}[ \\\\t]*$`);\n\t// An indented opening fence strips up to that indentation from each body line.\n\tconst openLine: string = lines[start] ?? '';\n\tconst openIndent: number = openLine.length - openLine.trimStart().length;\n\n\tconst body: string[] = [];\n\tlet i: number = start + 1;\n\twhile (i < lines.length) {\n\t\tconst line: string = lines[i] ?? '';\n\t\tif (closeRe.test(line)) {\n\t\t\ti++;\n\t\t\tbreak;\n\t\t}\n\t\tbody.push(stripLeadingSpaces(line, openIndent));\n\t\ti++;\n\t}\n\ttokens.push({ type: 'code_block', language, code: body.join('\\n') });\n\treturn i;\n}\n\n/** Removes up to `max` leading spaces from a line. */\nfunction stripLeadingSpaces(line: string, max: number): string {\n\tlet i = 0;\n\twhile (i < max && line[i] === ' ') i++;\n\treturn line.slice(i);\n}\n\n/**\n * Whether a line opens an indented code block (#195): at least four columns of\n * leading whitespace (tab-aware). Indented content that belongs to an open\n * list item never reaches this check — it is consumed into the item's content\n * region first (#194).\n */\nfunction canStartIndentedCode(line: string): boolean {\n\treturn indentColumns(line) >= INDENTED_CODE_COLUMNS;\n}\n\n/** Columns of leading whitespace, with tabs advancing to 4-column tab stops. */\nfunction indentColumns(line: string): number {\n\tlet col = 0;\n\tfor (const ch of line) {\n\t\tif (ch === ' ') col++;\n\t\telse if (ch === '\\t') col += 4 - (col % 4);\n\t\telse break;\n\t}\n\treturn col;\n}\n\n/**\n * Strips `columns` columns of leading whitespace (tab-aware). The remaining\n * leading whitespace is re-emitted as spaces measured in absolute columns:\n * tab stops depend on the column a tab starts in, so dedented lines must not\n * carry raw tabs whose width would be recomputed in the wrong context.\n */\nfunction stripIndent(line: string, columns: number): string {\n\tlet col = 0;\n\tlet i = 0;\n\twhile (i < line.length) {\n\t\tconst ch: string = line[i] ?? '';\n\t\tif (ch === ' ') col++;\n\t\telse if (ch === '\\t') col += 4 - (col % 4);\n\t\telse break;\n\t\ti++;\n\t}\n\treturn ' '.repeat(Math.max(0, col - columns)) + line.slice(i);\n}\n\n/**\n * Strips `columns` columns of leading whitespace from a code line, preserving\n * literal tabs beyond the strip boundary. Indented-code content is literal, so\n * tabs are significant (Makefiles, Go) and must survive verbatim — unlike\n * {@link stripIndent}, which normalizes re-tokenized structural whitespace to\n * spaces. Only a tab straddling the strip boundary contributes spaces (the part\n * of its width past `columns`); tabs fully past the boundary are kept as-is.\n */\nfunction stripCodeIndent(line: string, columns: number): string {\n\tlet col = 0;\n\tlet i = 0;\n\twhile (i < line.length && col < columns) {\n\t\tconst ch: string = line[i] ?? '';\n\t\tif (ch === ' ') {\n\t\t\tcol++;\n\t\t\ti++;\n\t\t} else if (ch === '\\t') {\n\t\t\tconst next: number = col + 4 - (col % 4);\n\t\t\tif (next > columns) {\n\t\t\t\t// Straddling tab: emit only its overflow past the boundary as spaces\n\t\t\t\t// and keep the remainder of the line (including later tabs) verbatim.\n\t\t\t\treturn ' '.repeat(next - columns) + line.slice(i + 1);\n\t\t\t}\n\t\t\tcol = next;\n\t\t\ti++;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn line.slice(i);\n}\n\n/**\n * Consumes an indented code block: all subsequent lines indented by at least\n * four columns, keeping interior blank lines but not trailing ones (they\n * separate the block from what follows). Returns the next line index.\n */\nfunction consumeIndentedCode(\n\tlines: readonly string[],\n\tstart: number,\n\ttokens: BlockToken[],\n): number {\n\tconst body: string[] = [];\n\tconst pendingBlanks: string[] = [];\n\tlet i: number = start;\n\twhile (i < lines.length) {\n\t\tconst line: string = lines[i] ?? '';\n\t\tif (isBlank(line)) {\n\t\t\t// Interior blank lines keep their content beyond the stripped columns.\n\t\t\tpendingBlanks.push(stripCodeIndent(line, INDENTED_CODE_COLUMNS));\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (indentColumns(line) < INDENTED_CODE_COLUMNS) break;\n\t\twhile (pendingBlanks.length > 0) body.push(pendingBlanks.shift() ?? '');\n\t\tbody.push(stripCodeIndent(line, INDENTED_CODE_COLUMNS));\n\t\ti++;\n\t}\n\ttokens.push({ type: 'code_block', language: '', code: body.join('\\n') });\n\treturn i - pendingBlanks.length;\n}\n\n/** Tries each extension's `matchBlock`; pushes a token and returns lines consumed (0 = no match). */\nfunction tryExtensionBlock(\n\textensions: readonly MarkdownSyntaxExtension[],\n\tlines: readonly string[],\n\tlineIndex: number,\n\ttokens: BlockToken[],\n): number {\n\tfor (const ext of extensions) {\n\t\tconst match = ext.matchBlock?.(lines, lineIndex);\n\t\tif (match && match.linesConsumed > 0) {\n\t\t\ttokens.push({ type: 'extension_block', nodeType: match.type, attrs: match.attrs });\n\t\t\treturn match.linesConsumed;\n\t\t}\n\t}\n\treturn 0;\n}\n\n/**\n * Consumes consecutive `>`-prefixed lines (plus lazy paragraph continuation\n * lines, per CommonMark) and recurses into their content. A plain line\n * continues the quote only while the innermost open block is a paragraph.\n */\nfunction consumeBlockquote(\n\tlines: readonly string[],\n\tstart: number,\n\ttokens: BlockToken[],\n\tgfm: boolean,\n\textensions: readonly MarkdownSyntaxExtension[],\n\tdepth: number,\n): number {\n\tconst inner: string[] = [];\n\tlet i: number = start;\n\tlet lazyOk = false;\n\twhile (i < lines.length) {\n\t\tconst line: string = lines[i] ?? '';\n\t\tif (BLOCKQUOTE.test(line)) {\n\t\t\tconst stripped: string = line.replace(BLOCKQUOTE, '');\n\t\t\tinner.push(stripped);\n\t\t\tlazyOk = continuesAsParagraph(stripped);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (\n\t\t\tlazyOk &&\n\t\t\t!isBlank(line) &&\n\t\t\t!interruptsParagraph(line) &&\n\t\t\t!(gfm && matchTable(lines, i, interruptsParagraph))\n\t\t) {\n\t\t\tinner.push(line);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\ttokens.push({ type: 'blockquote', children: tokenizeLines(inner, gfm, extensions, depth + 1) });\n\treturn i;\n}\n\n/**\n * Whether a stripped container line leaves a paragraph open at its innermost\n * level: quote prefixes and list markers are peeled off (`> 1. > text` opens a\n * paragraph two containers deep, which a lazy line may continue).\n */\nfunction continuesAsParagraph(stripped: string): boolean {\n\tlet content: string = stripped;\n\tfor (;;) {\n\t\tif (BLOCKQUOTE.test(content)) {\n\t\t\tcontent = content.replace(BLOCKQUOTE, '');\n\t\t\tcontinue;\n\t\t}\n\t\tconst marker: ListMarker | null = matchListMarker(content);\n\t\tif (marker && marker.firstText !== '') {\n\t\t\tcontent = marker.firstText;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\tif (content.trim() === '' || interruptsParagraph(content)) return false;\n\t// An indented-code line is not a paragraph, so nothing can lazily continue it.\n\treturn indentColumns(content) < INDENTED_CODE_COLUMNS;\n}\n\n/** Geometry and metadata of a single list-marker line. */\ninterface ListMarker {\n\treadonly listType: 'bullet' | 'ordered' | 'checklist';\n\treadonly checked: boolean;\n\t/** Column where the item's content begins; region lines must reach it. */\n\treadonly contentColumn: number;\n\t/** The marker line's own content (task prefix stripped), '' for empty items. */\n\treadonly firstText: string;\n\t/** The ordered start number (1 for bullets). */\n\treadonly startNumber: number;\n}\n\n/** Columns spanned by a whitespace run starting at an absolute column. */\nfunction columnsFrom(start: number, whitespace: string): number {\n\tlet col: number = start;\n\tfor (const ch of whitespace) {\n\t\tif (ch === ' ') col++;\n\t\telse if (ch === '\\t') col += 4 - (col % 4);\n\t\telse break;\n\t}\n\treturn col - start;\n}\n\n/**\n * Parses a list-marker line into its content-column geometry, or null when the\n * line is not a valid marker: markers indented four or more columns are\n * indented code or lazy text, never list items (CommonMark).\n */\nfunction matchListMarker(line: string): ListMarker | null {\n\tconst bullet: RegExpMatchArray | null = line.match(BULLET_ITEM);\n\tconst ordered: RegExpMatchArray | null = bullet ? null : line.match(ORDERED_ITEM);\n\tconst match: RegExpMatchArray | null = bullet ?? ordered;\n\tif (!match) return null;\n\n\tconst leadingColumns: number = indentColumns(match[1] ?? '');\n\tif (leadingColumns > MAX_MARKER_INDENT_COLUMNS) return null;\n\n\tconst markerText: string = (bullet ? match[2] : `${match[2]}${match[3]}`) ?? '-';\n\tconst markerEnd: number = leadingColumns + markerText.length;\n\tconst spacing: string = (bullet ? match[3] : match[4]) ?? '';\n\tconst spacingColumns: number = columnsFrom(markerEnd, spacing);\n\tconst rawContent: string = (bullet ? match[4] : match[5]) ?? '';\n\tconst startNumber: number = ordered ? Number.parseInt(match[2] ?? '1', 10) : 1;\n\n\tlet contentColumn: number;\n\tlet firstText: string;\n\tif (rawContent.trim() === '') {\n\t\tcontentColumn = markerEnd + 1;\n\t\tfirstText = '';\n\t} else if (spacingColumns >= 5) {\n\t\t// Content five or more columns past the marker starts as indented code;\n\t\t// the content column sits one past the marker (CommonMark).\n\t\tcontentColumn = markerEnd + 1;\n\t\tfirstText = ' '.repeat(spacingColumns - 1) + rawContent;\n\t} else {\n\t\tcontentColumn = markerEnd + spacingColumns;\n\t\tfirstText = rawContent;\n\t}\n\n\tconst task: RegExpMatchArray | null = firstText.match(TASK_PREFIX);\n\tif (task) {\n\t\treturn {\n\t\t\tlistType: 'checklist',\n\t\t\tchecked: (task[1] ?? ' ').toLowerCase() === 'x',\n\t\t\tcontentColumn,\n\t\t\tfirstText: task[2] ?? '',\n\t\t\tstartNumber,\n\t\t};\n\t}\n\treturn {\n\t\tlistType: ordered ? 'ordered' : 'bullet',\n\t\tchecked: false,\n\t\tcontentColumn,\n\t\tfirstText,\n\t\tstartNumber,\n\t};\n}\n\n/**\n * Consumes one list item: the marker line plus its content region — every\n * following line indented to the content column (dedented), interior blank\n * lines, and lazy paragraph continuation lines. The collected content is\n * tokenized recursively; nested list items are hoisted into flat siblings.\n * Returns the next line index.\n */\nfunction consumeListItem(\n\tlines: readonly string[],\n\tstart: number,\n\tmarker: ListMarker,\n\ttokens: BlockToken[],\n\tgfm: boolean,\n\textensions: readonly MarkdownSyntaxExtension[],\n\tdepth: number,\n): number {\n\tconst region: string[] = [];\n\tconst tracker: (line: string, paragraphOpen: boolean) => boolean = createParagraphTracker();\n\tlet firstText: string = marker.firstText;\n\tlet paragraphOpen: boolean = firstText === '' ? false : tracker(firstText, false);\n\tlet pendingBlanks = 0;\n\tlet i: number = start + 1;\n\n\twhile (i < lines.length) {\n\t\tconst line: string = lines[i] ?? '';\n\n\t\tif (isBlank(line)) {\n\t\t\t// An item may begin with at most one blank line: a marker with no\n\t\t\t// content followed by a blank line stays an empty item (CommonMark).\n\t\t\tif (firstText === '' && region.length === 0) break;\n\t\t\tpendingBlanks++;\n\t\t\tparagraphOpen = false;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (indentColumns(line) >= marker.contentColumn) {\n\t\t\twhile (pendingBlanks > 0) {\n\t\t\t\tregion.push('');\n\t\t\t\tpendingBlanks--;\n\t\t\t}\n\t\t\tconst dedented: string = stripIndent(line, marker.contentColumn);\n\t\t\tregion.push(dedented);\n\t\t\tparagraphOpen = tracker(dedented, paragraphOpen);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Under-indented: only a lazy paragraph continuation keeps the item open.\n\t\t// Any valid marker line is a sibling item, never lazy text (the\n\t\t// ordered-must-start-at-1 interrupt rule applies to paragraphs only).\n\t\tif (matchListMarker(line)) break;\n\t\tif (!paragraphOpen) break;\n\t\tif (interruptsParagraph(line)) break;\n\t\tif (gfm && matchTable(lines, i, interruptsParagraph)) break;\n\t\t// A lazy line belongs textually to the open paragraph: fold it into the\n\t\t// previous logical line so it can never re-parse as a block start in the\n\t\t// item's sub-document (`- d\\n - e` keeps \"- e\" as paragraph text).\n\t\tconst lazy: string = line.trimStart();\n\t\tconst lastRegionLine: string | undefined = region[region.length - 1];\n\t\tif (lastRegionLine !== undefined) {\n\t\t\tregion[region.length - 1] = `${lastRegionLine}\\n${lazy}`;\n\t\t} else {\n\t\t\tfirstText = firstText === '' ? lazy : `${firstText}\\n${lazy}`;\n\t\t}\n\t\tparagraphOpen = tracker(lazy, paragraphOpen);\n\t\ti++;\n\t}\n\n\tappendListItemTokens(marker, firstText, region, tokens, gfm, extensions, depth);\n\treturn i;\n}\n\n/**\n * Tracks whether the innermost open block of an item's content region is a\n * paragraph — the precondition for lazy continuation. Fenced code suspends\n * laziness until the fence closes; block starters close the paragraph. The\n * caller passes whether a paragraph is currently open, because an indented line\n * cannot start an indented code block while a paragraph is open (CommonMark): it\n * continues that paragraph instead, and only opens a code block from a closed\n * state.\n */\nfunction createParagraphTracker(): (line: string, paragraphOpen: boolean) => boolean {\n\tlet closeRe: RegExp | null = null;\n\treturn (line: string, paragraphOpen: boolean): boolean => {\n\t\tif (closeRe) {\n\t\t\tif (closeRe.test(line)) closeRe = null;\n\t\t\treturn false;\n\t\t}\n\t\tconst fence: RegExpMatchArray | null = matchFenceOpen(line);\n\t\tif (fence) {\n\t\t\tconst fenceStr: string = fence[1] ?? '```';\n\t\t\tconst fenceChar: string = fenceStr[0] ?? '`';\n\t\t\tcloseRe = new RegExp(`^ {0,3}${`\\\\${fenceChar}`}{${fenceStr.length},}[ \\\\t]*$`);\n\t\t\treturn false;\n\t\t}\n\t\tif (isBlank(line)) return false;\n\t\tif (BLOCKQUOTE.test(line) || matchListMarker(line)) return continuesAsParagraph(line);\n\t\t// Indented code cannot interrupt an open paragraph: an indented line keeps\n\t\t// the paragraph open, and only opens a code block when none is open.\n\t\tif (indentColumns(line) >= INDENTED_CODE_COLUMNS) return paragraphOpen;\n\t\treturn !interruptsParagraph(line);\n\t};\n}\n\n/**\n * Builds the item token(s) from the marker line and its dedented content\n * region: the content is tokenized recursively; a single-paragraph result\n * keeps the item a leaf, anything else becomes a container with block\n * children. Nested list items are hoisted out into flat siblings one indent\n * deeper (the editor's flat-with-indent sibling model).\n */\nfunction appendListItemTokens(\n\tmarker: ListMarker,\n\tfirstText: string,\n\tregion: readonly string[],\n\ttokens: BlockToken[],\n\tgfm: boolean,\n\textensions: readonly MarkdownSyntaxExtension[],\n\tdepth: number,\n): void {\n\tconst subLines: string[] = firstText === '' ? [...region] : [firstText, ...region];\n\tconst subTokens: BlockToken[] =\n\t\tsubLines.length === 0 ? [] : tokenizeLines(subLines, gfm, extensions, depth + 1);\n\n\tconst lifted: BlockToken[] = [];\n\tconst own: BlockToken[] = [];\n\tfor (const token of subTokens) {\n\t\tif (token.type === 'list_item') {\n\t\t\tlifted.push({ ...token, indent: token.indent + 1 });\n\t\t} else {\n\t\t\town.push(token);\n\t\t}\n\t}\n\n\tconst first: BlockToken | undefined = own[0];\n\tif (own.length === 1 && first?.type === 'paragraph') {\n\t\ttokens.push(makeListItemToken(marker, first.text));\n\t} else if (own.length === 0) {\n\t\ttokens.push(makeListItemToken(marker, ''));\n\t} else {\n\t\ttokens.push(makeListItemToken(marker, '', own));\n\t}\n\ttokens.push(...lifted);\n}\n\n/** Builds a `list_item` token at indent 0 of the current tokenization level. */\nfunction makeListItemToken(\n\tmarker: ListMarker,\n\ttext: string,\n\tchildren?: readonly BlockToken[],\n): BlockToken {\n\tconst base = {\n\t\ttype: 'list_item' as const,\n\t\tlistType: marker.listType,\n\t\tindent: 0,\n\t\tchecked: marker.checked,\n\t\ttext,\n\t};\n\treturn children ? { ...base, children } : base;\n}\n\n/**\n * Whether a list-item line may interrupt an open paragraph: CommonMark forbids\n * empty items and ordered items not starting at 1 from doing so (`14.` in prose\n * must not begin a list).\n */\nfunction listItemInterrupts(line: string): boolean {\n\tconst marker: ListMarker | null = matchListMarker(line);\n\tif (!marker) return false;\n\tif (marker.firstText.trim() === '') return false;\n\tif (marker.listType === 'ordered') return marker.startNumber === 1;\n\treturn true;\n}\n\n/** Whether a line begins a block-level HTML element (inline tags fall through). */\nfunction isHtmlBlockStart(line: string): boolean {\n\tconst match: RegExpMatchArray | null = line.match(HTML_BLOCK_START);\n\tif (!match) return false;\n\tif (line.trimStart().startsWith('<!--')) return true;\n\tconst tag: string = (match[2] ?? '').toLowerCase();\n\treturn BLOCK_HTML_TAGS.has(tag);\n}\n\n/** Consumes an HTML block up to the next blank line. */\nfunction consumeHtmlBlock(lines: readonly string[], start: number, tokens: BlockToken[]): number {\n\tconst html: string[] = [];\n\tlet i: number = start;\n\twhile (i < lines.length) {\n\t\tconst line: string = lines[i] ?? '';\n\t\tif (isBlank(line)) break;\n\t\thtml.push(line);\n\t\ti++;\n\t}\n\ttokens.push({ type: 'html', html: html.join('\\n') });\n\treturn i;\n}\n\n/** Whether a line would interrupt an open paragraph (begins another block). */\nfunction interruptsParagraph(line: string): boolean {\n\tif (isBlank(line)) return true;\n\tif (ATX_HEADING.test(line)) return true;\n\tif (matchFenceOpen(line)) return true;\n\tif (THEMATIC_BREAK.test(line)) return true;\n\tif (BLOCKQUOTE.test(line)) return true;\n\tif (listItemInterrupts(line)) return true;\n\tif (isHtmlBlockStart(line)) return true;\n\treturn false;\n}\n\n/** Consumes a paragraph (with lazy continuation) or a setext heading. */\nfunction consumeParagraph(lines: readonly string[], start: number, tokens: BlockToken[]): number {\n\tconst collected: string[] = [lines[start] ?? ''];\n\tlet i: number = start + 1;\n\n\twhile (i < lines.length) {\n\t\tconst line: string = lines[i] ?? '';\n\n\t\t// A setext underline turns the collected paragraph into a heading.\n\t\tif (SETEXT_H1.test(line)) {\n\t\t\ttokens.push({ type: 'heading', level: 1, text: joinParagraph(collected) });\n\t\t\treturn i + 1;\n\t\t}\n\t\t// A `-` underline outranks a thematic break when a paragraph sits above it.\n\t\tif (SETEXT_H2.test(line)) {\n\t\t\ttokens.push({ type: 'heading', level: 2, text: joinParagraph(collected) });\n\t\t\treturn i + 1;\n\t\t}\n\n\t\tif (interruptsParagraph(line)) break;\n\t\tcollected.push(line);\n\t\ti++;\n\t}\n\n\ttokens.push({ type: 'paragraph', text: joinParagraphText(collected) });\n\treturn i;\n}\n\n/**\n * Joins collected paragraph lines for inline parsing. Leading indentation is\n * insignificant and stripped, but trailing spaces on interior lines are kept:\n * two or more of them encode a hard break, which the inline parser consumes\n * (#193). The final line's trailing whitespace carries no meaning and is\n * dropped.\n */\nfunction joinParagraphText(lines: readonly string[]): string {\n\treturn lines\n\t\t.map((line, index) => (index === lines.length - 1 ? line.trim() : line.trimStart()))\n\t\t.join('\\n');\n}\n\n/** Joins multi-line paragraph text into a single-line heading string. */\nfunction joinParagraph(lines: readonly string[]): string {\n\treturn lines\n\t\t.map((l) => l.trim())\n\t\t.join(' ')\n\t\t.trim();\n}\n","/**\n * Minimal HTML-only schema for Markdown's raw-HTML seam.\n *\n * Registry-free Markdown calls still need the portable structures owned by the\n * codec when a block must become raw HTML (for example to retain an `htmlId`).\n * An explicitly supplied registry is returned unchanged and remains the sole\n * authority. No plugin or view module is imported here.\n */\n\nimport { escapeAttr, sanitizeHref } from '../../model/HTMLUtils.js';\nimport type { HTMLExportContext } from '../../model/NodeSpec.js';\nimport { SchemaRegistry } from '../../model/SchemaRegistry.js';\nimport {\n\tTABLE_COLUMN_WIDTH_DATA_ATTRIBUTE,\n\tTABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE,\n\tnormalizeTableColumnWidthsPx,\n\tserializeTableDimensionAttrs,\n} from '../TableDimensions.js';\n\nlet baselineRegistry: SchemaRegistry | undefined;\n\n/** Resolves the schema at an HTML boundary without supplementing an explicit schema. */\nexport function resolveMarkdownHTMLRegistry(registry?: SchemaRegistry): SchemaRegistry {\n\tif (registry) return registry;\n\tbaselineRegistry ??= createBaselineRegistry();\n\treturn baselineRegistry;\n}\n\nfunction htmlOnlyDOM(): HTMLElement {\n\tthrow new Error('The Markdown HTML registry cannot render editor DOM.');\n}\n\nfunction createBaselineRegistry(): SchemaRegistry {\n\tconst registry = new SchemaRegistry();\n\tregisterBlocks(registry);\n\tregisterMarks(registry);\n\tregisterInlineNodes(registry);\n\treturn registry;\n}\n\nfunction registerBlocks(registry: SchemaRegistry): void {\n\tregistry.registerNodeSpec({\n\t\ttype: 'paragraph',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML: (_node, content) => `<p>${content || '<br>'}</p>`,\n\t\tparseHTML: [{ tag: 'p' }, { tag: 'div', priority: 10 }],\n\t\tsanitize: { tags: ['p'] },\n\t});\n\n\tregistry.registerNodeSpec({\n\t\ttype: 'heading',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML(node, content) {\n\t\t\tconst raw: unknown = node.attrs?.level;\n\t\t\tconst level: number =\n\t\t\t\ttypeof raw === 'number' && Number.isFinite(raw)\n\t\t\t\t\t? Math.max(1, Math.min(6, Math.floor(raw)))\n\t\t\t\t\t: 1;\n\t\t\treturn `<h${level}>${content || '<br>'}</h${level}>`;\n\t\t},\n\t\tparseHTML: [1, 2, 3, 4, 5, 6].map((level) => ({\n\t\t\ttag: `h${level}`,\n\t\t\tgetAttrs: () => ({ level }),\n\t\t})),\n\t\tsanitize: { tags: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] },\n\t});\n\n\tregistry.registerNodeSpec({\n\t\ttype: 'list_item',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML(node, content) {\n\t\t\tif (node.attrs?.listType !== 'checklist') return `<li>${content || '<br>'}</li>`;\n\t\t\tconst checked: boolean = node.attrs.checked === true;\n\t\t\treturn (\n\t\t\t\t`<li role=\"checkbox\" aria-checked=\"${String(checked)}\">` +\n\t\t\t\t`<input type=\"checkbox\" disabled${checked ? ' checked' : ''}>` +\n\t\t\t\t`${content || '<br>'}</li>`\n\t\t\t);\n\t\t},\n\t\tparseHTML: [{ tag: 'li' }],\n\t\tsanitize: {\n\t\t\ttags: ['ul', 'ol', 'li', 'input'],\n\t\t\tattrs: ['type', 'disabled', 'checked', 'role', 'aria-checked'],\n\t\t},\n\t});\n\n\tregistry.registerNodeSpec({\n\t\ttype: 'blockquote',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML: (_node, content) => `<blockquote>${content || '<br>'}</blockquote>`,\n\t\tparseHTML: [{ tag: 'blockquote' }],\n\t\tsanitize: { tags: ['blockquote'] },\n\t});\n\n\tregistry.registerNodeSpec({\n\t\ttype: 'code_block',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML(node, content) {\n\t\t\tconst language: string = String(node.attrs?.language ?? '');\n\t\t\tconst languageClass: string = language ? ` class=\"language-${escapeAttr(language)}\"` : '';\n\t\t\treturn `<pre><code${languageClass}>${content}</code></pre>`;\n\t\t},\n\t\tparseHTML: [\n\t\t\t{\n\t\t\t\ttag: 'pre',\n\t\t\t\tgetAttrs(el) {\n\t\t\t\t\tconst code: HTMLElement | null = el.querySelector('code');\n\t\t\t\t\tconst language: string = code?.className.match(/(?:^|\\s)language-(\\S+)/)?.[1] ?? '';\n\t\t\t\t\treturn { language };\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tsanitize: { tags: ['pre', 'code'], attrs: ['class'] },\n\t});\n\n\tregistry.registerNodeSpec({\n\t\ttype: 'horizontal_rule',\n\t\tisVoid: true,\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML: () => '<hr>',\n\t\tparseHTML: [{ tag: 'hr' }],\n\t\tsanitize: { tags: ['hr'] },\n\t});\n\n\tregistry.registerNodeSpec({\n\t\ttype: 'image',\n\t\tisVoid: true,\n\t\tattrs: {\n\t\t\tsrc: { default: '' },\n\t\t\talt: { default: '' },\n\t\t\ttitle: { default: '' },\n\t\t\talign: { default: 'center' },\n\t\t},\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML(node) {\n\t\t\tconst src: string = escapeAttr(String(node.attrs?.src ?? ''));\n\t\t\tconst alt: string = escapeAttr(String(node.attrs?.alt ?? ''));\n\t\t\tconst title: string = String(node.attrs?.title ?? '');\n\t\t\tconst titleAttr: string = title ? ` title=\"${escapeAttr(title)}\"` : '';\n\t\t\tconst dimension = (name: string, value: unknown): string =>\n\t\t\t\ttypeof value === 'number' && Number.isFinite(value) && value > 0\n\t\t\t\t\t? ` ${name}=\"${String(value)}\"`\n\t\t\t\t\t: '';\n\t\t\treturn (\n\t\t\t\t`<figure><img src=\"${src}\" alt=\"${alt}\"${titleAttr}` +\n\t\t\t\t`${dimension('width', node.attrs?.width)}${dimension('height', node.attrs?.height)}></figure>`\n\t\t\t);\n\t\t},\n\t\tparseHTML: [\n\t\t\t{\n\t\t\t\ttag: 'figure',\n\t\t\t\tgetAttrs(el) {\n\t\t\t\t\tconst image: HTMLImageElement | null = el.querySelector('img');\n\t\t\t\t\treturn image ? imageAttrs(image) : false;\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ tag: 'img', getAttrs: (el) => imageAttrs(el as HTMLImageElement) },\n\t\t],\n\t\tsanitize: {\n\t\t\ttags: ['figure', 'img'],\n\t\t\tattrs: ['src', 'alt', 'title', 'width', 'height'],\n\t\t},\n\t});\n\n\tregistry.registerNodeSpec({\n\t\ttype: 'table',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML(node, content, ctx?: HTMLExportContext) {\n\t\t\tconst widths: readonly (number | null)[] | undefined = normalizeTableColumnWidthsPx(\n\t\t\t\tnode.attrs?.columnWidthsPx,\n\t\t\t);\n\t\t\tconst colgroup: string = widths\n\t\t\t\t? `<colgroup>${widths\n\t\t\t\t\t\t.map((width: number | null): string => {\n\t\t\t\t\t\t\tconst attrs: string = serializeTableDimensionAttrs(\n\t\t\t\t\t\t\t\tTABLE_COLUMN_WIDTH_DATA_ATTRIBUTE,\n\t\t\t\t\t\t\t\t'width',\n\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn `<col${attrs}>`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join('')}</colgroup>`\n\t\t\t\t: '';\n\t\t\tconst tableAttrs: string = widths ? tableDimensionStyle(widths, ctx) : '';\n\t\t\treturn `<table${tableAttrs}>${colgroup}<tbody>${content}</tbody></table>`;\n\t\t},\n\t\tsanitize: {\n\t\t\ttags: ['table', 'colgroup', 'col', 'thead', 'tbody', 'tfoot'],\n\t\t\tattrs: ['span', 'width', TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE],\n\t\t},\n\t});\n\n\tregistry.registerNodeSpec({\n\t\ttype: 'table_row',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML(node, content, ctx?: HTMLExportContext) {\n\t\t\tconst attrs: string = serializeTableDimensionAttrs(\n\t\t\t\tTABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE,\n\t\t\t\t'height',\n\t\t\t\tnode.attrs?.minHeightPx,\n\t\t\t\tctx,\n\t\t\t);\n\t\t\treturn `<tr${attrs}>${content}</tr>`;\n\t\t},\n\t\tsanitize: {\n\t\t\ttags: ['tr'],\n\t\t\tattrs: ['height', TABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE],\n\t\t},\n\t});\n\n\tregistry.registerNodeSpec({\n\t\ttype: 'table_cell',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTML(node, content) {\n\t\t\tconst span = (name: string, value: unknown): string =>\n\t\t\t\ttypeof value === 'number' && Number.isInteger(value) && value > 1\n\t\t\t\t\t? ` ${name}=\"${String(value)}\"`\n\t\t\t\t\t: '';\n\t\t\treturn `<td${span('colspan', node.attrs?.colspan)}${span(\n\t\t\t\t'rowspan',\n\t\t\t\tnode.attrs?.rowspan,\n\t\t\t)}>${content}</td>`;\n\t\t},\n\t\tsanitize: { tags: ['td', 'th'], attrs: ['colspan', 'rowspan'] },\n\t});\n}\n\nfunction tableDimensionStyle(widths: readonly (number | null)[], ctx?: HTMLExportContext): string {\n\tconst minimumWidthPx: number = widths.reduce<number>(\n\t\t(total: number, width: number | null): number => total + (width ?? 60),\n\t\t0,\n\t);\n\tconst allExplicit: boolean = widths.every(\n\t\t(width: number | null): width is number => width !== null,\n\t);\n\tconst declarations: string = allExplicit\n\t\t? `width: ${String(minimumWidthPx)}px; min-width: ${String(minimumWidthPx)}px; table-layout: fixed`\n\t\t: `width: 100%; min-width: ${String(minimumWidthPx)}px; table-layout: fixed`;\n\treturn ctx?.styleAttr(declarations) ?? ` style=\"${declarations}\"`;\n}\n\nfunction imageAttrs(image: HTMLImageElement): Record<string, string | number | boolean> {\n\tconst attrs: Record<string, string | number | boolean> = {\n\t\t...inlineImageAttrs(image),\n\t\talign: 'center',\n\t};\n\tfor (const name of ['width', 'height'] as const) {\n\t\tconst value: number = Number.parseFloat(image.getAttribute(name) ?? '');\n\t\tif (Number.isFinite(value) && value > 0) attrs[name] = value;\n\t}\n\treturn attrs;\n}\n\nfunction inlineImageAttrs(image: HTMLImageElement): Record<string, string> {\n\tconst attrs: Record<string, string> = {\n\t\tsrc: image.getAttribute('src') ?? '',\n\t\talt: image.getAttribute('alt') ?? '',\n\t};\n\tconst title: string | null = image.getAttribute('title');\n\tif (title) attrs.title = title;\n\treturn attrs;\n}\n\nfunction registerMarks(registry: SchemaRegistry): void {\n\tconst tagMarks: readonly {\n\t\treadonly type: string;\n\t\treadonly rank: number;\n\t\treadonly tag: string;\n\t\treadonly parseTags: readonly string[];\n\t}[] = [\n\t\t{ type: 'bold', rank: 0, tag: 'strong', parseTags: ['strong', 'b'] },\n\t\t{ type: 'italic', rank: 1, tag: 'em', parseTags: ['em', 'i'] },\n\t\t{ type: 'underline', rank: 2, tag: 'u', parseTags: ['u'] },\n\t\t{ type: 'code', rank: 3, tag: 'code', parseTags: ['code'] },\n\t\t{ type: 'strikethrough', rank: 4, tag: 's', parseTags: ['s', 'strike', 'del'] },\n\t];\n\n\tfor (const mark of tagMarks) {\n\t\tregistry.registerMarkSpec({\n\t\t\ttype: mark.type,\n\t\t\trank: mark.rank,\n\t\t\ttoDOM: htmlOnlyDOM,\n\t\t\ttoHTMLString: (_value, content) => `<${mark.tag}>${content}</${mark.tag}>`,\n\t\t\tparseHTML: mark.parseTags.map((tag) => ({\n\t\t\t\ttag,\n\t\t\t\tgetAttrs:\n\t\t\t\t\ttag === 'code' ? (el) => (el.parentElement?.tagName === 'PRE' ? false : {}) : undefined,\n\t\t\t})),\n\t\t\tsanitize: { tags: mark.parseTags },\n\t\t});\n\t}\n\n\tregistry.registerMarkSpec({\n\t\ttype: 'link',\n\t\trank: 10,\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTMLString(mark, content) {\n\t\t\tconst href: string = escapeAttr(sanitizeHref(String(mark.attrs?.href ?? '')));\n\t\t\tconst title: string = String(mark.attrs?.title ?? '');\n\t\t\tconst titleAttr: string = title ? ` title=\"${escapeAttr(title)}\"` : '';\n\t\t\treturn `<a href=\"${href}\"${titleAttr}>${content}</a>`;\n\t\t},\n\t\tparseHTML: [\n\t\t\t{\n\t\t\t\ttag: 'a',\n\t\t\t\tgetAttrs(el) {\n\t\t\t\t\tconst href: string = sanitizeHref(el.getAttribute('href') ?? '');\n\t\t\t\t\tconst title: string | null = el.getAttribute('title');\n\t\t\t\t\treturn title ? { href, title } : { href };\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tsanitize: { tags: ['a'], attrs: ['href', 'title'] },\n\t});\n}\n\nfunction registerInlineNodes(registry: SchemaRegistry): void {\n\tregistry.registerInlineNodeSpec({\n\t\ttype: 'hard_break',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTMLString: () => '<br>',\n\t\tparseHTML: [{ tag: 'br' }],\n\t\tsanitize: { tags: ['br'] },\n\t});\n\n\tregistry.registerInlineNodeSpec({\n\t\ttype: 'image_inline',\n\t\ttoDOM: htmlOnlyDOM,\n\t\ttoHTMLString(node) {\n\t\t\tconst src: string = escapeAttr(String(node.attrs.src ?? ''));\n\t\t\tconst alt: string = escapeAttr(String(node.attrs.alt ?? ''));\n\t\t\tconst title: string = String(node.attrs.title ?? '');\n\t\t\tconst titleAttr: string = title ? ` title=\"${escapeAttr(title)}\"` : '';\n\t\t\treturn `<img src=\"${src}\" alt=\"${alt}\"${titleAttr}>`;\n\t\t},\n\t\tparseHTML: [{ tag: 'img', getAttrs: (el) => inlineImageAttrs(el as HTMLImageElement) }],\n\t\tsanitize: { tags: ['img'], attrs: ['src', 'alt', 'title'] },\n\t});\n}\n"],"mappings":"8KAm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AC,QAAS,UAAoB,CAChD,MAAM,EAAgB,OAAO,WAAW,EAAM,aAAa,IAAS,IAChE,OAAO,SAAS,IAAU,EAAQ,IAAG,EAAM,GAAQ,EACxD,CACA,OAAO,CACR,CAEA,SAAS,GAAiB,GACzB,MAAM,EAAgC,CACrC,IAAK,EAAM,aAAa,QAAU,GAClC,IAAK,EAAM,aAAa,QAAU,IAE7B,EAAuB,EAAM,aAAa,SAEhD,OADI,IAAO,EAAM,MAAQ,GAClB,CACR"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t}from"./rolldown-runtime-H_PjY6_i.mjs";import{T as e,l as s,o as n,s as i,u as r}from"./Document-827l3P80.mjs";import{a as o,i as l,r as h}from"./TypeBrands-Ch9856Gb.mjs";import{n as c}from"./ContentModel-NpAj7vGW.mjs";import{t as a}from"./DocumentParser-D2tr3ZKn.mjs";import{c as u,d as p,f,l as m,n as d,o as x,s as g,t as k,u as v}from"./MarkdownHTMLRegistry-Q7l0d6Ma.mjs";function y(t,e=""){return{type:t,literal:e,children:[],href:"",title:"",alt:"",inlineType:"",attrs:{},prev:null,next:null}}function b(t,e){e.prev=t,e.next=t.next,t.next&&(t.next.prev=e),t.next=e}function _(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.prev=null,t.next=null}var w=/[\s*_~(]/,S=/^[a-zA-Z0-9_-]+$/,A=/[a-zA-Z0-9.+_-]+@[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)+/y,D=/[a-zA-Z0-9.+_-]/,T=/[a-zA-Z0-9_-]/;function W(t,e){const s=t[e]??"";return("h"===s||"w"===s||"m"===s||"x"===s||"f"===s)&&!(e>0&&!w.test(t[e-1]??""))&&(t.startsWith("http://",e)||t.startsWith("https://",e)||t.startsWith("ftp://",e)||t.startsWith("www.",e)||t.startsWith("mailto:",e)||t.startsWith("xmpp:",e))}function z(t,e){let s=e;for(;s<t.length;){const e=t[s]??"";if("<"===e||/\s/.test(e))break;s++}return function(t){let e=0,s=0;for(const i of t)"("===i?e++:")"===i&&s++;let n=t.length;for(;n>0;){const i=t[n-1]??"";if("?!.,:*_~".includes(i))n--;else{if(!(")"===i&&s>e)){if(";"===i){let e=n-2;for(;e>0&&/[a-zA-Z0-9]/.test(t[e]??"");)e--;if("&"===t[e]&&e<n-2){n=e;continue}}break}n--,s--}}return t.slice(0,n)}(t.slice(e,s))}function O(t){const e=t.search(/[/?#:]/);return-1===e?t:t.slice(0,e)}function Z(t){const e=t.split(".");return!(e.length<2||!e.every(t=>S.test(t))||e.slice(-2).some(t=>t.includes("_")))}function $(t){return!t.endsWith("-")&&!t.endsWith("_")}function E(t){!function(t){let e=0;for(const s of t){const n=e>0?t[e-1]:void 0;n&&"text"===n.type&&"text"===s.type?n.literal+=s.literal:(t[e]=s,e++)}t.length=e}(t);for(let e=0;e<t.length;e++){const s=t[e];if(s&&!C(s.type)){if("text"===s.type){const n=I(s.literal);n&&(t.splice(e,1,...n),e+=n.length-1);continue}s.children.length>0&&E(s.children)}}}function C(t){return"link"===t||"image"===t||"code"===t||"html_inline"===t||"inline_node"===t}function I(t){const e=[];let s=0,n=t.indexOf("@");for(;-1!==n;){let i=n;for(;i>s&&D.test(t[i-1]??"");)i--;let r=n+1;for(;r<t.length&&(T.test(t[r]??"")||"."===t[r]);)r++;for(;r>n+1&&"."===t[r-1];)r--;const o=t.slice(i,r);if(i<n&&B(o,r-n-1)){i>s&&e.push(y("text",t.slice(s,i)));const l=y("link");l.href=`mailto:${o}`,l.children=[y("text",o)],e.push(l),s=r,n=t.indexOf("@",r);continue}n=t.indexOf("@",n+1)}return 0===e.length?null:(s<t.length&&e.push(y("text",t.slice(s))),e)}function B(t,e){if(e<=0)return!1;const s=t.slice(t.indexOf("@")+1).split(".");return!(s.length<2)&&!s.some(t=>""===t)&&$(t)}var M=/^ {0,3}\[((?:\\.|[^\\[\]])+)\]:(.*)$/,L=/^( {0,3}(?:> ?)+)(.*)$/,N=/^[ \t]*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|\(((?:\\.|[^()\\])*)\))[ \t]*$/,j=/^ {0,3}(`{3,}|~{3,})[ \t]*$/;function R(t){return t.trim().replace(/[ \t\n]+/g," ").toLowerCase().toUpperCase().toLowerCase()}function G(t,e,s,n,i){const r=t[e]??"",o=r.match(M);if(!o){if(""===s){const t=r.match(L);if(t?.[1]&&M.test(t[2]??"")&&G([t[2]??""],0,t[1],n,[])>0)return i.push(t[1].trimEnd()),1}return 0}const l=o[1]??"";let h=(o[2]??"").trim(),c=1;if(""===h&&""===s){const s=t[e+c]??"";if(""===s.trim())return 0;h=s.trim(),c++}if(""===h)return 0;const a=function(t){if("<"===t[0]){let e=1;for(;e<t.length;){const s=t[e]??"";if("\\"!==s){if(">"===s)return{href:p(t.slice(1,e)),end:e+1};if("<"===s)return null;e++}else e+=2}return null}let e=0,s=0;for(;s<t.length;){const n=t[s]??"";if(" "===n||"\t"===n)break;if("\\"!==n){if("("===n&&e++,")"===n){if(0===e)break;e--}s++}else s+=2}return 0===s?null:{href:p(t.slice(0,s)),end:s}}(h);if(!a)return 0;const u=h.slice(a.end).trim();let f;if(""!==u){const t=u.match(N);if(!t)return 0;f=H(t)}else if(""===s){const s=(t[e+c]??"").match(N);s&&(f=H(s),c++)}const m=R(l);return""===m||n.has(m)||n.set(m,void 0!==f?{href:a.href,title:f}:{href:a.href}),c}function H(t){return p(t[1]??t[2]??t[3]??"")}var q=8192,F=/[\p{P}\p{S}]/u,K=/[!-/:-@[-`{-~]/,P=/[!-/:-@[-`{-~]/,J=new Set(["u","sup","sub","span","mark","b","i","em","strong","code","s","del","small","abbr","kbd","a"]);function U(t){return""===t||/\s/.test(t)}function Q(t){return""!==t&&(t.charCodeAt(0)<128?K.test(t):F.test(t))}var V=class{pos=0;text;len;ctx;delimiters=null;brackets=null;tail=null;constructor(t,e){this.text=t,this.len=t.length,this.ctx=e}parse(){const t=y("text");for(this.tail=t;this.pos<this.len;){const t=this.parseToken();t&&this.appendNode(t)}return this.processEmphasis(null),function(t){const e=[];let s=t.next;for(;s;)e.push(s),s=s.next;return e}(t)}appendNode(t){this.tail&&b(this.tail,t),this.tail=t}parseToken(){const t=this.text[this.pos]??"";switch(t){case"\n":return this.parseNewline();case"\\":return this.parseBackslash();case"`":return this.parseBackticks();case"*":case"_":case"~":case"=":case"^":return this.parseDelimiterRun(t);case"[":return this.parseOpenBracket(!1);case"!":return"["===this.text[this.pos+1]?this.parseOpenBracket(!0):(this.pos++,y("text","!"));case"]":return this.parseCloseBracket();case"<":return this.parseLessThan();case"&":return this.parseEntity();default:{const t=this.parseGfmAutolink();if(t)return t;return this.parseExtension()||this.parseString()}}}parseString(){const t=this.pos;for(this.pos++;this.pos<this.len;){const t=this.text[this.pos]??"";if("\n\\`*_~=^[]!<&".includes(t))break;if(this.matchesGfmAutolinkStart())break;if(this.matchesExtensionStart())break;this.pos++}return y("text",this.text.slice(t,this.pos))}parseGfmAutolink(){if(!this.ctx.opts.gfm||this.brackets)return null;const t=(e=this.text,s=this.pos,W(e,s)?e.startsWith("http://",s)||e.startsWith("https://",s)||e.startsWith("ftp://",s)?function(t,e){const s=z(t,e),n=t.startsWith("https://",e)?8:t.startsWith("http://",e)?7:6;return Z(O(s.slice(n)))?{href:s,display:s,length:s.length}:null}(e,s):e.startsWith("www.",s)?function(t,e){const s=z(t,e);return Z(O(s))?{href:`http://${s}`,display:s,length:s.length}:null}(e,s):function(t,e){const s=t.startsWith("mailto:",e)?7:5;A.lastIndex=e+s;const n=A.exec(t)?.[0];if(!n||!$(n))return null;const i=t.slice(e,e+s+n.length);return{href:i,display:i,length:i.length}}(e,s):null);var e,s;if(!t)return null;this.pos+=t.length;const n=y("link");return n.href=t.href,n.children=[y("text",t.display)],n}matchesGfmAutolinkStart(){return!(!this.ctx.opts.gfm||this.brackets)&&W(this.text,this.pos)}parseExtension(){for(const t of this.ctx.opts.syntaxExtensions){const e=t.matchInline?.(this.text,this.pos);if(e){this.pos+=e.length;const t=y("inline_node");return t.inlineType=e.type,t.attrs=e.attrs,t}}return null}matchesExtensionStart(){for(const t of this.ctx.opts.syntaxExtensions)if(t.matchInline?.(this.text,this.pos))return!0;return!1}parseNewline(){for(this.pos++;" "===this.text[this.pos];)this.pos++;const t=this.tail;if(t&&"text"===t.type&&t.literal.endsWith(" ")){const e=t.literal.endsWith(" ");return t.literal=t.literal.replace(/[ \t]+$/,""),y(e?"hardbreak":"softbreak")}return y("softbreak")}parseBackslash(){this.pos++;const t=this.text[this.pos]??"";if("\n"===t){for(this.pos++;" "===this.text[this.pos];)this.pos++;return y("hardbreak")}return P.test(t)?(this.pos++,y("text",t)):y("text","\\")}parseBackticks(){const t=this.pos;let e=0;for(;"`"===this.text[this.pos];)e++,this.pos++;const s="`".repeat(e),n=this.pos;let i=n;for(;i<this.len;){const t=this.text.indexOf(s,i);if(-1===t)break;if("`"!==this.text[t-1]&&"`"!==this.text[t+e]){let s=this.text.slice(n,t).replace(/\n/g," ");return s.length>2&&s.startsWith(" ")&&s.endsWith(" ")&&""!==s.trim()&&(s=s.slice(1,-1)),this.pos=t+e,y("code",s)}i=t+1}return this.pos=n,y("text",this.text.slice(t,n))}parseDelimiterRun(t){const{numdelims:e,canOpen:s,canClose:n}=this.scanDelims(t),i=y("text",t.repeat(e)),r={cc:t,numdelims:e,origdelims:e,node:i,canOpen:s,canClose:n,prev:this.delimiters,next:null};return this.delimiters&&(this.delimiters.next=r),this.delimiters=r,i}scanDelims(t){const e=this.pos;for(;this.text[this.pos]===t;)this.pos++;const s=this.pos-e,n=0===e?"":this.text[e-1]??"",i=this.text[this.pos]??"",r=U(n),o=U(i),l=Q(n),h=Q(i),c=!o&&(!h||r||l),a=!r&&(!l||o||h);let u,p;return"_"===t?(u=c&&(!a||l),p=a&&(!c||h)):(u=c,p=a),{numdelims:s,canOpen:u,canClose:p}}parseOpenBracket(t){const e=t?"![":"[";this.pos+=e.length;const s=y("text",e);return this.brackets={node:s,prev:this.brackets,prevDelim:this.delimiters,index:this.pos,image:t,active:!0},s}parseCloseBracket(){this.pos++;const t=this.brackets;if(!t||!t.active)return t&&(this.brackets=t.prev),y("text","]");const e=this.parseLinkTarget(t);if(!e)return this.brackets=t.prev,y("text","]");const s=y(t.image?"image":"link");s.href=e.href,s.title=e.title,this.processEmphasis(t.prevDelim);let n=t.node.next;for(;n;){const t=n.next;_(n),s.children.push(n),n=t}if(t.image&&(s.alt=tt(s.children),s.children=[]),b(t.node,s),_(t.node),this.tail=s,!t.image){let e=t.prev;for(;e;)e.image||(e.active=!1),e=e.prev}return this.brackets=t.prev,null}parseLinkTarget(t){if("("===this.text[this.pos]){const t=this.parseInlineDestination();if(t)return t}let e=this.text.slice(t.index,this.pos-1),s=!1,n=this.pos;if("["===this.text[this.pos]){const t=this.text.indexOf("]",this.pos+1);if(-1!==t){const i=this.text.slice(this.pos+1,t);""!==i.trim()&&(e=i,s=!0),n=t+1}}if(!s&&e.includes("["))return null;const i=this.ctx.linkRefs.get(R(e));return i?(this.pos=n,{href:i.href,title:i.title??""}):null}parseInlineDestination(){let t=this.pos+1;for(;" "===this.text[t]||"\n"===this.text[t];)t++;let e="";if("<"===this.text[t]){let s=t+1;const n=Math.min(this.len,t+1+q);for(;s<n;){const t=this.text[s]??"";if("\\"===t&&P.test(this.text[s+1]??""))s+=2;else{if(">"===t||"<"===t||"\n"===t)break;s++}}if(">"!==this.text[s])return null;e=p(this.text.slice(t+1,s)),t=s+1}else{let s=0;const n=Math.min(this.len,t+q);for(;t<n;){const n=this.text[t]??"";if("\\"===n&&P.test(this.text[t+1]??""))e+=this.text[t+1],t+=2;else{if("("===n)s++;else if(")"===n){if(0===s)break;s--}else if(" "===n||"\t"===n||"\n"===n||"["===n||"]"===n)break;e+=n,t++}}if(t>=n&&")"!==this.text[t])return null;e=m(e)}for(;" "===this.text[t]||"\n"===this.text[t];)t++;let s="";const n=this.text[t]??"";if('"'===n||"'"===n||"("===n){const e=this.parseLinkTitle(t);if(!e)return null;s=e.title,t=e.next}for(;" "===this.text[t]||"\n"===this.text[t];)t++;return")"!==this.text[t]?null:(this.pos=t+1,{href:e,title:s})}parseLinkTitle(t){const e=this.text[t]??"",s="("===e?")":e;let n="",i=t+1;const r=Math.min(this.len,t+1+q);for(;i<r;){const t=this.text[i]??"";if("\\"===t&&P.test(this.text[i+1]??""))n+=this.text[i+1],i+=2;else{if(t===s)return{title:m(n),next:i+1};n+=t,i++}}return null}parseEntity(){const t=f(this.text,this.pos);return t?.[1]?(this.pos+=t[0].length,y("text",v(t[1]))):(this.pos++,y("text","&"))}parseLessThan(){const t=this.parseAutolink();if(t)return t;return this.parseInlineHtml()||(this.pos++,y("text","<"))}parseAutolink(){const t=this.text.slice(this.pos),e=t.match(/^<([a-zA-Z][a-zA-Z0-9+.-]{1,31}:[^<>\s]*)>/);if(e?.[1]){this.pos+=e[0].length;const t=y("link");return t.href=e[1],t.children=[y("text",e[1])],t}const s=t.match(/^<([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])?)*)>/);if(s?.[1]){this.pos+=s[0].length;const t=y("link");return t.href=`mailto:${s[1]}`,t.children=[y("text",s[1])],t}return null}parseInlineHtml(){const t=this.text.slice(this.pos),e=t.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s[^<>]*)?>/);if(!e?.[1]){const e=t.match(/^<!--[\s\S]*?-->/);return e?(this.pos+=e[0].length,y("html_inline",Y(e[0]))):null}const s=e[1].toLowerCase();if(J.has(s)){const t=`</${s}>`,n=this.text.toLowerCase().indexOf(t,this.pos+e[0].length);if(-1!==n){const e=n+t.length,s=this.text.slice(this.pos,e);return this.pos=e,y("html_inline",Y(s))}}return this.pos+=e[0].length,y("html_inline",Y(e[0]))}processEmphasis(t){const e=/* @__PURE__ */new Map,s=s=>{const n=X(s);return e.has(n)?e.get(n)??null:t};let n=t?t.next:this.firstDelimiter();for(;n;){if(!n.canClose){n=n.next;continue}const i=n.cc;let r=n.prev,o=!1;const l=s(n);for(;r&&r!==t&&r!==l;){if(r.cc===i&&r.canOpen&&this.emphMatches(r,n)){o=!0;break}r=r.prev}if(!o){e.set(X(n),n.prev),n.canOpen||this.removeDelimiter(n),n=n.next;continue}const h=r,c=this.wrapCount(i,h,n);if(0!==c){if(this.wrapEmphasis(i,h,n,c),h.numdelims-=c,n.numdelims-=c,h.node.literal=h.node.literal.slice(c),n.node.literal=n.node.literal.slice(c),this.removeDelimitersBetween(h,n),0===h.numdelims&&this.removeDelimiter(h),0===n.numdelims){const t=n.next;this.removeDelimiter(n),n=t}}else n=n.next}for(;this.delimiters&&this.delimiters!==t;)this.removeDelimiter(this.delimiters)}firstDelimiter(){let t=this.delimiters;for(;t?.prev;)t=t.prev;return t}emphMatches(t,e){return"*"!==t.cc&&"_"!==t.cc||!((e.canOpen||t.canClose)&&e.origdelims%3!=0&&(t.origdelims+e.origdelims)%3==0)}wrapCount(t,e,s){const n=e.numdelims>=2&&s.numdelims>=2;return"*"===t||"_"===t?n?2:1:"~"===t?this.ctx.opts.gfm&&n?2:this.ctx.opts.extendedInlineSyntax?1:0:"="===t?this.ctx.opts.extendedInlineSyntax&&n?2:0:"^"===t&&this.ctx.opts.extendedInlineSyntax?1:0}wrapKind(t,e){return"*"===t||"_"===t?2===e?"strong":"emph":"~"===t?2===e?"strike":"sub":"="===t?"highlight":"sup"}wrapEmphasis(t,e,s,n){const i=y(this.wrapKind(t,n));let r=e.node.next;for(;r&&r!==s.node;){const t=r.next;_(r),i.children.push(r),r=t}b(e.node,i)}removeDelimitersBetween(t,e){let s=e.prev;for(;s&&s!==t;){const t=s.prev;this.removeDelimiter(s),s=t}}removeDelimiter(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.next||(this.delimiters=t.prev)}};function X(t){return`${t.cc}${t.canOpen?1:0}${t.origdelims%3}`}function Y(t){return t.replace(/\n[ \t]*/g," ")}function tt(t){let e="";for(const s of t)"text"===s.type||"code"===s.type?e+=s.literal:"softbreak"===s.type||"hardbreak"===s.type?e+=" ":s.children.length?e+=tt(s.children):s.alt&&(e+=s.alt);return e}var et={emph:"italic",strong:"bold",strike:"strikethrough",highlight:"highlight",sup:"superscript",sub:"subscript"};function st(t,e,s,n){for(const i of t)nt(i,e,s,n)}function nt(t,e,n,i){switch(t.type){case"text":return void(t.literal&&i.push(r(t.literal,[...e])));case"softbreak":return void i.push(r(" ",[...e]));case"hardbreak":return void i.push(s(h("hard_break"),{}));case"code":return void i.push(r(t.literal,it(e,n,"code")));case"link":{const s={href:t.href};return t.title&&(s.title=t.title),void st(t.children,it(e,n,"link",s),n,i)}case"image":return void function(t,e,n,i){if(!n.registry||void 0!==n.registry.getInlineNodeSpec("image_inline")){const n={src:t.href,alt:t.alt};return t.title&&(n.title=t.title),void i.push(s(h("image_inline"),n,[...e]))}t.alt&&i.push(r(t.alt,[...e]))}(t,e,n,i);case"inline_node":return void i.push(s(h(t.inlineType),t.attrs,[...e]));case"html_inline":return void function(t,e,n,i){if((!n.registry||void 0!==n.registry.getInlineNodeSpec("hard_break"))&&/^<br\s*\/?>$/i.test(t.trim()))return void i.push(s(h("hard_break"),{},[...e]));const o=a(`<p>${t}</p>`,k(n.registry)).children[0];if(!o)return;let l=!1;for(const h of o.children)"text"in h&&""!==h.text?(i.push(r(h.text,rt(e,h.marks))),l=!0):"inlineType"in h&&(i.push(s(h.inlineType,h.attrs,rt(e,h.marks))),l=!0);l||n.registry||i.push(r(t,[...e]))}(t.literal,e,n,i);default:{const s=et[t.type];st(t.children,s?it(e,n,s):e,n,i)}}}function it(t,e,s,n){if(!function(t,e){return!t.registry||void 0!==t.registry.getMarkSpec(e)}(e,s))return[...t];const i=n?{type:l(s),attrs:n}:{type:l(s)};return[...t,i]}function rt(t,e){const s=[...t];for(const n of e)s.some(t=>t.type===n.type)||s.push(n);return s}function ot(t,e){if(t.length!==e.length)return!1;const s=t=>`${t.type}:${JSON.stringify(t.attrs??{})}`,n=new Set(e.map(s));return t.every(t=>n.has(s(t)))}function lt(t,e){const s=new V(t,e).parse();e.opts.gfm&&E(s);const n=[];st(s,[],e,n);const i=function(t){const e=[];for(const s of t){const t=e[e.length-1];"text"in s&&t&&"text"in t&&ot(t.marks,s.marks)?e[e.length-1]={type:"text",text:t.text+s.text,marks:t.marks}:e.push(s)}return e}(n);return i.length>0?i:[r("")]}function ht(t){const e=t?.flavor??"gfm";return{flavor:e,gfm:"gfm"===e,extendedInlineSyntax:t?.extendedInlineSyntax??!1,htmlFallback:!1!==t?.htmlFallback,syntaxExtensions:t?.syntaxExtensions??[]}}var ct=/* @__PURE__ */t({parseMarkdownToDocument:()=>at});function at(t,e,s){const{source:n,linkRefs:r}=function(t){const e=/* @__PURE__ */new Map,s=t.split("\n"),n=[];let i=null,r=!1,o=0;for(;o<s.length;){const t=s[o]??"";if(i){n.push(t);const e=t.match(j)?.[1];e&&e[0]===i.char&&e.length>=i.len&&(i=null),r=!1,o++;continue}const l=g(t);if(l?.[1]){i={char:l[1][0]??"`",len:l[1].length},n.push(t),r=!1,o++;continue}const h=r?0:G(s,o,"",e,n);h>0?o+=h:(n.push(t),r=""!==t.trim()&&!d.test(t)&&!x.test(t),o++)}return{source:n.join("\n"),linkRefs:e}}(t.replace(/\r\n?/g,"\n")),o={registry:e,opts:ht(s),linkRefs:r},l=ut(u(n,o.opts.gfm,o.opts.syntaxExtensions),o);if(0===l.length)return i();const h=i(l);return e?c(h,e):h}function ut(t,e){const s=[];for(const n of t)pt(n,s,e);return s}function pt(t,s,i){switch(t.type){case"heading":return void s.push(ft("heading",lt(t.text,i),i,{level:t.level}));case"paragraph":{const l=lt(t.text,i),h=function(t,s){if(1!==t.length)return null;const i=t[0];if(!i||!e(i)||"image_inline"!==i.inlineType)return null;if(i.marks.length>0)return null;if(s.registry&&!s.registry.getNodeSpec("image"))return null;const l={src:String(i.attrs.src??""),alt:String(i.attrs.alt??""),align:"center"};return i.attrs.title&&(l.title=String(i.attrs.title)),n(o("image"),[r("")],void 0,l)}(l,i);return void s.push(h??ft("paragraph",l,i))}case"table":return void s.push(function(t,e,s,i){if(i.registry&&!i.registry.getNodeSpec("table"))return ft("paragraph",lt([e,...s].map(t=>t.join(" | ")).join("\n"),i),i);const r=e=>{const s=e.map((e,s)=>{const r=t[s]??null,l=n(o("paragraph"),lt(e,i),void 0,r?{align:r}:void 0);return n(o("table_cell"),[l])});return n(o("table_row"),s)},l=e.length,h=[r(e),...s.map(t=>r((t=>{if(t.length===l)return t;const e=t.slice(0,l);for(;e.length<l;)e.push("");return e})(t)))];return n(o("table"),h)}(t.aligns,t.header,t.rows,i));case"extension_block":return void s.push(ft(t.nodeType,[r("")],i,t.attrs));case"code_block":return void s.push(ft("code_block",[r(t.code)],i,{language:t.language}));case"hr":return void s.push(ft("horizontal_rule",[r("")],i));case"list_item":{const e={listType:t.listType,indent:t.indent,checked:t.checked};if(t.children&&t.children.length>0){const r=ut(t.children,i);return i.registry&&!i.registry.getNodeSpec("list_item")?void s.push(...r):void s.push(n(o("list_item"),r,void 0,e))}return void s.push(ft("list_item",lt(t.text,i),i,e))}case"blockquote":{const e=ut(t.children,i);return 0===e.length&&e.push(n(o("paragraph"),[r("")])),void s.push(function(t,e,s){const i=mt(t,s);return i!==o(t)?e[0]??n(o("paragraph"),[r("")]):n(i,e)}("blockquote",e,i))}case"html":if(function(t){let e=t.trim();for(;e.startsWith("\x3c!--");){const t=e.indexOf("--\x3e");if(-1===t)return!1;e=e.slice(t+3).trim()}return""===e}(t.html))return;for(const e of a(t.html,k(i.registry)).children)s.push(e);return}}function ft(t,e,s,i){const l=mt(t,s);return n(l,e.length>0?e:[r("")],void 0,i&&l===o(t)?i:void 0)}function mt(t,e){return e.registry&&!e.registry.getNodeSpec(t)?o("paragraph"):o(t)}export{at as n,ct as t};
|
|
2
|
+
//# sourceMappingURL=MarkdownParser-Dp62mfUq.mjs.map
|