phormat 0.0.5
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 +102 -0
- package/dist/assets/example-test.svelte +228 -0
- package/dist/debug/JsonDebug.svelte +19 -0
- package/dist/debug/JsonDebug.svelte.d.ts +6 -0
- package/dist/debug/JsonDebugNode.svelte +138 -0
- package/dist/debug/JsonDebugNode.svelte.d.ts +11 -0
- package/dist/demo/documentLifecycle.d.ts +57 -0
- package/dist/demo/documentLifecycle.js +196 -0
- package/dist/demo/index.d.ts +2 -0
- package/dist/demo/index.js +2 -0
- package/dist/editor/BlockEditor.svelte +112 -0
- package/dist/editor/BlockEditor.svelte.d.ts +7 -0
- package/dist/editor/BlockRow.svelte +76 -0
- package/dist/editor/BlockRow.svelte.d.ts +20 -0
- package/dist/editor/Editor.svelte +103 -0
- package/dist/editor/Editor.svelte.d.ts +7 -0
- package/dist/editor/MarkdownEditor.svelte.d.ts +160 -0
- package/dist/editor/MarkdownEditor.svelte.js +1119 -0
- package/dist/editor/NestedRowChrome.svelte +160 -0
- package/dist/editor/NestedRowChrome.svelte.d.ts +20 -0
- package/dist/editor/PhormatEditor.svelte +206 -0
- package/dist/editor/PhormatEditor.svelte.d.ts +26 -0
- package/dist/editor/RawMarkdownPanel.svelte +39 -0
- package/dist/editor/RawMarkdownPanel.svelte.d.ts +6 -0
- package/dist/editor/block-specs/BlockSpecMissing.svelte +12 -0
- package/dist/editor/block-specs/BlockSpecMissing.svelte.d.ts +7 -0
- package/dist/editor/block-specs/blockquote/BlockquoteRenderer.svelte +32 -0
- package/dist/editor/block-specs/blockquote/BlockquoteRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/blockquote/commands.d.ts +2 -0
- package/dist/editor/block-specs/blockquote/commands.js +65 -0
- package/dist/editor/block-specs/blockquote/index.d.ts +6 -0
- package/dist/editor/block-specs/blockquote/index.js +5 -0
- package/dist/editor/block-specs/blockquote/inlineSecondPass.d.ts +6 -0
- package/dist/editor/block-specs/blockquote/inlineSecondPass.js +35 -0
- package/dist/editor/block-specs/blockquote/parse.d.ts +16 -0
- package/dist/editor/block-specs/blockquote/parse.js +188 -0
- package/dist/editor/block-specs/blockquote/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/blockquote/reconcile.js +9 -0
- package/dist/editor/block-specs/blockquote/serialize.d.ts +6 -0
- package/dist/editor/block-specs/blockquote/serialize.js +55 -0
- package/dist/editor/block-specs/blockquote/types.d.ts +20 -0
- package/dist/editor/block-specs/blockquote/types.js +1 -0
- package/dist/editor/block-specs/blockquoteSpec.d.ts +4 -0
- package/dist/editor/block-specs/blockquoteSpec.js +37 -0
- package/dist/editor/block-specs/callout/CalloutRenderer.svelte +38 -0
- package/dist/editor/block-specs/callout/CalloutRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/callout/CalloutTypeIcon.svelte +14 -0
- package/dist/editor/block-specs/callout/CalloutTypeIcon.svelte.d.ts +7 -0
- package/dist/editor/block-specs/callout/commands.d.ts +2 -0
- package/dist/editor/block-specs/callout/commands.js +65 -0
- package/dist/editor/block-specs/callout/icons.d.ts +10 -0
- package/dist/editor/block-specs/callout/icons.js +52 -0
- package/dist/editor/block-specs/callout/index.d.ts +9 -0
- package/dist/editor/block-specs/callout/index.js +7 -0
- package/dist/editor/block-specs/callout/inlineSecondPass.d.ts +6 -0
- package/dist/editor/block-specs/callout/inlineSecondPass.js +9 -0
- package/dist/editor/block-specs/callout/parse.d.ts +9 -0
- package/dist/editor/block-specs/callout/parse.js +83 -0
- package/dist/editor/block-specs/callout/parseBody.d.ts +6 -0
- package/dist/editor/block-specs/callout/parseBody.js +290 -0
- package/dist/editor/block-specs/callout/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/callout/reconcile.js +8 -0
- package/dist/editor/block-specs/callout/serialize.d.ts +5 -0
- package/dist/editor/block-specs/callout/serialize.js +65 -0
- package/dist/editor/block-specs/callout/types.d.ts +7 -0
- package/dist/editor/block-specs/callout/types.js +1 -0
- package/dist/editor/block-specs/calloutSpec.d.ts +2 -0
- package/dist/editor/block-specs/calloutSpec.js +23 -0
- package/dist/editor/block-specs/codeFence/CodeFenceRenderer.svelte +18 -0
- package/dist/editor/block-specs/codeFence/CodeFenceRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/codeFence/commands.d.ts +2 -0
- package/dist/editor/block-specs/codeFence/commands.js +1 -0
- package/dist/editor/block-specs/codeFence/index.d.ts +5 -0
- package/dist/editor/block-specs/codeFence/index.js +4 -0
- package/dist/editor/block-specs/codeFence/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/codeFence/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/codeFence/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/codeFence/reconcile.js +5 -0
- package/dist/editor/block-specs/codeFence/serialize.d.ts +2 -0
- package/dist/editor/block-specs/codeFence/serialize.js +8 -0
- package/dist/editor/block-specs/codeFence/types.d.ts +6 -0
- package/dist/editor/block-specs/codeFence/types.js +1 -0
- package/dist/editor/block-specs/codeFenceSpec.d.ts +2 -0
- package/dist/editor/block-specs/codeFenceSpec.js +23 -0
- package/dist/editor/block-specs/columns/ColumnsRenderer.svelte +18 -0
- package/dist/editor/block-specs/columns/ColumnsRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/columns/EditableColumns.svelte +16 -0
- package/dist/editor/block-specs/columns/EditableColumns.svelte.d.ts +4 -0
- package/dist/editor/block-specs/columns/commands.d.ts +2 -0
- package/dist/editor/block-specs/columns/commands.js +1 -0
- package/dist/editor/block-specs/columns/index.d.ts +6 -0
- package/dist/editor/block-specs/columns/index.js +5 -0
- package/dist/editor/block-specs/columns/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/columns/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/columns/parse.d.ts +20 -0
- package/dist/editor/block-specs/columns/parse.js +111 -0
- package/dist/editor/block-specs/columns/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/columns/reconcile.js +6 -0
- package/dist/editor/block-specs/columns/serialize.d.ts +2 -0
- package/dist/editor/block-specs/columns/serialize.js +16 -0
- package/dist/editor/block-specs/columns/types.d.ts +4 -0
- package/dist/editor/block-specs/columns/types.js +1 -0
- package/dist/editor/block-specs/columnsSpec.d.ts +2 -0
- package/dist/editor/block-specs/columnsSpec.js +24 -0
- package/dist/editor/block-specs/heading/HeaderRenderer.svelte +30 -0
- package/dist/editor/block-specs/heading/HeaderRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/heading/commands.d.ts +2 -0
- package/dist/editor/block-specs/heading/commands.js +41 -0
- package/dist/editor/block-specs/heading/edit.d.ts +10 -0
- package/dist/editor/block-specs/heading/edit.js +33 -0
- package/dist/editor/block-specs/heading/index.d.ts +7 -0
- package/dist/editor/block-specs/heading/index.js +6 -0
- package/dist/editor/block-specs/heading/inlineSecondPass.d.ts +4 -0
- package/dist/editor/block-specs/heading/inlineSecondPass.js +20 -0
- package/dist/editor/block-specs/heading/parse.d.ts +5 -0
- package/dist/editor/block-specs/heading/parse.js +18 -0
- package/dist/editor/block-specs/heading/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/heading/reconcile.js +8 -0
- package/dist/editor/block-specs/heading/serialize.d.ts +2 -0
- package/dist/editor/block-specs/heading/serialize.js +9 -0
- package/dist/editor/block-specs/heading/types.d.ts +5 -0
- package/dist/editor/block-specs/heading/types.js +1 -0
- package/dist/editor/block-specs/headingSpec.d.ts +2 -0
- package/dist/editor/block-specs/headingSpec.js +28 -0
- package/dist/editor/block-specs/horizontalRule/HorizontalRuleRenderer.svelte +15 -0
- package/dist/editor/block-specs/horizontalRule/HorizontalRuleRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/horizontalRule/commands.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/commands.js +1 -0
- package/dist/editor/block-specs/horizontalRule/index.d.ts +6 -0
- package/dist/editor/block-specs/horizontalRule/index.js +5 -0
- package/dist/editor/block-specs/horizontalRule/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/horizontalRule/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/horizontalRule/parse.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/parse.js +15 -0
- package/dist/editor/block-specs/horizontalRule/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/reconcile.js +5 -0
- package/dist/editor/block-specs/horizontalRule/serialize.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/serialize.js +3 -0
- package/dist/editor/block-specs/horizontalRule/types.d.ts +3 -0
- package/dist/editor/block-specs/horizontalRule/types.js +1 -0
- package/dist/editor/block-specs/horizontalRuleSpec.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRuleSpec.js +24 -0
- package/dist/editor/block-specs/list/ListRenderer.svelte +70 -0
- package/dist/editor/block-specs/list/ListRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/list/commands.d.ts +2 -0
- package/dist/editor/block-specs/list/commands.js +65 -0
- package/dist/editor/block-specs/list/index.d.ts +6 -0
- package/dist/editor/block-specs/list/index.js +5 -0
- package/dist/editor/block-specs/list/inlineSecondPass.d.ts +6 -0
- package/dist/editor/block-specs/list/inlineSecondPass.js +78 -0
- package/dist/editor/block-specs/list/parse.d.ts +11 -0
- package/dist/editor/block-specs/list/parse.js +312 -0
- package/dist/editor/block-specs/list/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/list/reconcile.js +6 -0
- package/dist/editor/block-specs/list/serialize.d.ts +4 -0
- package/dist/editor/block-specs/list/serialize.js +83 -0
- package/dist/editor/block-specs/list/types.d.ts +27 -0
- package/dist/editor/block-specs/list/types.js +1 -0
- package/dist/editor/block-specs/listSpec.d.ts +4 -0
- package/dist/editor/block-specs/listSpec.js +24 -0
- package/dist/editor/block-specs/paragraph/ParagraphRenderer.svelte +22 -0
- package/dist/editor/block-specs/paragraph/ParagraphRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/paragraph/commands.d.ts +2 -0
- package/dist/editor/block-specs/paragraph/commands.js +41 -0
- package/dist/editor/block-specs/paragraph/edit.d.ts +10 -0
- package/dist/editor/block-specs/paragraph/edit.js +69 -0
- package/dist/editor/block-specs/paragraph/index.d.ts +7 -0
- package/dist/editor/block-specs/paragraph/index.js +6 -0
- package/dist/editor/block-specs/paragraph/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/paragraph/inlineSecondPass.js +25 -0
- package/dist/editor/block-specs/paragraph/parse.d.ts +9 -0
- package/dist/editor/block-specs/paragraph/parse.js +76 -0
- package/dist/editor/block-specs/paragraph/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/paragraph/reconcile.js +9 -0
- package/dist/editor/block-specs/paragraph/serialize.d.ts +4 -0
- package/dist/editor/block-specs/paragraph/serialize.js +39 -0
- package/dist/editor/block-specs/paragraph/types.d.ts +10 -0
- package/dist/editor/block-specs/paragraph/types.js +1 -0
- package/dist/editor/block-specs/paragraphSpec.d.ts +2 -0
- package/dist/editor/block-specs/paragraphSpec.js +24 -0
- package/dist/editor/block-specs/registry.d.ts +10 -0
- package/dist/editor/block-specs/registry.js +34 -0
- package/dist/editor/block-specs/table/TableRenderer.svelte +53 -0
- package/dist/editor/block-specs/table/TableRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/table/commands.d.ts +2 -0
- package/dist/editor/block-specs/table/commands.js +1 -0
- package/dist/editor/block-specs/table/edit.d.ts +10 -0
- package/dist/editor/block-specs/table/edit.js +127 -0
- package/dist/editor/block-specs/table/editCommands.d.ts +18 -0
- package/dist/editor/block-specs/table/editCommands.js +87 -0
- package/dist/editor/block-specs/table/index.d.ts +8 -0
- package/dist/editor/block-specs/table/index.js +6 -0
- package/dist/editor/block-specs/table/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/table/inlineSecondPass.js +22 -0
- package/dist/editor/block-specs/table/parse.d.ts +17 -0
- package/dist/editor/block-specs/table/parse.js +181 -0
- package/dist/editor/block-specs/table/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/table/reconcile.js +6 -0
- package/dist/editor/block-specs/table/serialize.d.ts +3 -0
- package/dist/editor/block-specs/table/serialize.js +32 -0
- package/dist/editor/block-specs/table/types.d.ts +11 -0
- package/dist/editor/block-specs/table/types.js +1 -0
- package/dist/editor/block-specs/tableSpec.d.ts +2 -0
- package/dist/editor/block-specs/tableSpec.js +25 -0
- package/dist/editor/block-specs/toc/EditableToc.svelte +16 -0
- package/dist/editor/block-specs/toc/EditableToc.svelte.d.ts +4 -0
- package/dist/editor/block-specs/toc/TocRenderer.svelte +22 -0
- package/dist/editor/block-specs/toc/TocRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/toc/commands.d.ts +2 -0
- package/dist/editor/block-specs/toc/commands.js +1 -0
- package/dist/editor/block-specs/toc/index.d.ts +6 -0
- package/dist/editor/block-specs/toc/index.js +5 -0
- package/dist/editor/block-specs/toc/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/toc/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/toc/parse.d.ts +10 -0
- package/dist/editor/block-specs/toc/parse.js +43 -0
- package/dist/editor/block-specs/toc/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/toc/reconcile.js +5 -0
- package/dist/editor/block-specs/toc/serialize.d.ts +2 -0
- package/dist/editor/block-specs/toc/serialize.js +6 -0
- package/dist/editor/block-specs/toc/types.d.ts +8 -0
- package/dist/editor/block-specs/toc/types.js +1 -0
- package/dist/editor/block-specs/tocSpec.d.ts +2 -0
- package/dist/editor/block-specs/tocSpec.js +24 -0
- package/dist/editor/block-specs/toggle/ToggleRenderer.svelte +19 -0
- package/dist/editor/block-specs/toggle/ToggleRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/toggle/commands.d.ts +2 -0
- package/dist/editor/block-specs/toggle/commands.js +1 -0
- package/dist/editor/block-specs/toggle/index.d.ts +7 -0
- package/dist/editor/block-specs/toggle/index.js +5 -0
- package/dist/editor/block-specs/toggle/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/toggle/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/toggle/parse.d.ts +9 -0
- package/dist/editor/block-specs/toggle/parse.js +78 -0
- package/dist/editor/block-specs/toggle/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/toggle/reconcile.js +6 -0
- package/dist/editor/block-specs/toggle/serialize.d.ts +4 -0
- package/dist/editor/block-specs/toggle/serialize.js +13 -0
- package/dist/editor/block-specs/toggle/types.d.ts +5 -0
- package/dist/editor/block-specs/toggle/types.js +1 -0
- package/dist/editor/block-specs/toggleSpec.d.ts +2 -0
- package/dist/editor/block-specs/toggleSpec.js +24 -0
- package/dist/editor/block-specs/types.d.ts +26 -0
- package/dist/editor/block-specs/types.js +1 -0
- package/dist/editor/blocks/EditableBlockquote.svelte +52 -0
- package/dist/editor/blocks/EditableBlockquote.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableBlockquoteNodes.svelte +134 -0
- package/dist/editor/blocks/EditableBlockquoteNodes.svelte.d.ts +14 -0
- package/dist/editor/blocks/EditableBlockquoteParagraph.svelte +44 -0
- package/dist/editor/blocks/EditableBlockquoteParagraph.svelte.d.ts +12 -0
- package/dist/editor/blocks/EditableCallout.svelte +182 -0
- package/dist/editor/blocks/EditableCallout.svelte.d.ts +11 -0
- package/dist/editor/blocks/EditableCalloutListItemRow.svelte +169 -0
- package/dist/editor/blocks/EditableCalloutListItemRow.svelte.d.ts +15 -0
- package/dist/editor/blocks/EditableCalloutNodes.svelte +91 -0
- package/dist/editor/blocks/EditableCalloutNodes.svelte.d.ts +13 -0
- package/dist/editor/blocks/EditableCalloutParagraph.svelte +39 -0
- package/dist/editor/blocks/EditableCalloutParagraph.svelte.d.ts +12 -0
- package/dist/editor/blocks/EditableCodeBlock.svelte +43 -0
- package/dist/editor/blocks/EditableCodeBlock.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableHeading.svelte +161 -0
- package/dist/editor/blocks/EditableHeading.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableHorizontalRule.svelte +20 -0
- package/dist/editor/blocks/EditableHorizontalRule.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableInlineSurface.svelte +423 -0
- package/dist/editor/blocks/EditableInlineSurface.svelte.d.ts +26 -0
- package/dist/editor/blocks/EditableList.svelte +77 -0
- package/dist/editor/blocks/EditableList.svelte.d.ts +17 -0
- package/dist/editor/blocks/EditableListItemRow.svelte +231 -0
- package/dist/editor/blocks/EditableListItemRow.svelte.d.ts +19 -0
- package/dist/editor/blocks/EditableParagraph.svelte +208 -0
- package/dist/editor/blocks/EditableParagraph.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableParagraphNodes.svelte +89 -0
- package/dist/editor/blocks/EditableParagraphNodes.svelte.d.ts +15 -0
- package/dist/editor/blocks/EditableTable.svelte +83 -0
- package/dist/editor/blocks/EditableTable.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableTableCell.svelte +89 -0
- package/dist/editor/blocks/EditableTableCell.svelte.d.ts +15 -0
- package/dist/editor/blocks/EditableToggle.svelte +94 -0
- package/dist/editor/blocks/EditableToggle.svelte.d.ts +10 -0
- package/dist/editor/commandMenu.d.ts +18 -0
- package/dist/editor/commandMenu.js +83 -0
- package/dist/editor/commandRegistry.d.ts +48 -0
- package/dist/editor/commandRegistry.js +133 -0
- package/dist/editor/context/assetBaseUrl.d.ts +6 -0
- package/dist/editor/context/assetBaseUrl.js +20 -0
- package/dist/editor/dom/editorHistoryKeydown.d.ts +6 -0
- package/dist/editor/dom/editorHistoryKeydown.js +31 -0
- package/dist/editor/dom/plainEnterKeydown.d.ts +12 -0
- package/dist/editor/dom/plainEnterKeydown.js +53 -0
- package/dist/editor/dom/plaintextCaret.d.ts +12 -0
- package/dist/editor/dom/plaintextCaret.js +61 -0
- package/dist/editor/dom/syncDocumentSelectionFocus.d.ts +17 -0
- package/dist/editor/dom/syncDocumentSelectionFocus.js +56 -0
- package/dist/editor/draftPersistence.d.ts +27 -0
- package/dist/editor/draftPersistence.js +83 -0
- package/dist/editor/editorHistoryHandle.d.ts +16 -0
- package/dist/editor/editorHistoryHandle.js +22 -0
- package/dist/editor/inlineChrome/InlineChromeCoordinator.svelte +174 -0
- package/dist/editor/inlineChrome/InlineChromeCoordinator.svelte.d.ts +8 -0
- package/dist/editor/inlineChrome/InlineFormattingToolbar.svelte +181 -0
- package/dist/editor/inlineChrome/InlineFormattingToolbar.svelte.d.ts +3 -0
- package/dist/editor/inlineChrome/inlineChromeActions.d.ts +17 -0
- package/dist/editor/inlineChrome/inlineChromeActions.js +148 -0
- package/dist/editor/inlineChrome/inlineChromeState.svelte.d.ts +23 -0
- package/dist/editor/inlineChrome/inlineChromeState.svelte.js +21 -0
- package/dist/editor/inlineChrome/inlineToolbarIcons.d.ts +14 -0
- package/dist/editor/inlineChrome/inlineToolbarIcons.js +14 -0
- package/dist/editor/inlineChrome/inlineWrapActive.d.ts +3 -0
- package/dist/editor/inlineChrome/inlineWrapActive.js +19 -0
- package/dist/editor/inlineChrome/selectionRect.d.ts +2 -0
- package/dist/editor/inlineChrome/selectionRect.js +23 -0
- package/dist/editor/model/blockEditCommands.d.ts +73 -0
- package/dist/editor/model/blockEditCommands.js +719 -0
- package/dist/editor/model/blockTree.d.ts +39 -0
- package/dist/editor/model/blockTree.js +185 -0
- package/dist/editor/model/blockTreeDrop.d.ts +9 -0
- package/dist/editor/model/blockTreeDrop.js +295 -0
- package/dist/editor/model/blockTreeMutations.d.ts +10 -0
- package/dist/editor/model/blockTreeMutations.js +68 -0
- package/dist/editor/model/calloutEditCommands.d.ts +39 -0
- package/dist/editor/model/calloutEditCommands.js +305 -0
- package/dist/editor/model/documentSelection.d.ts +8 -0
- package/dist/editor/model/documentSelection.js +56 -0
- package/dist/editor/model/documentSelectionFromSource.d.ts +3 -0
- package/dist/editor/model/documentSelectionFromSource.js +45 -0
- package/dist/editor/model/documentToRenderBlocks.d.ts +3 -0
- package/dist/editor/model/documentToRenderBlocks.js +13 -0
- package/dist/editor/model/editorPipeline.bench.d.ts +1 -0
- package/dist/editor/model/editorPipeline.bench.js +27 -0
- package/dist/editor/model/editorTransactions.d.ts +20 -0
- package/dist/editor/model/editorTransactions.js +68 -0
- package/dist/editor/model/emptyParagraph.d.ts +11 -0
- package/dist/editor/model/emptyParagraph.js +25 -0
- package/dist/editor/model/enterCommands.d.ts +16 -0
- package/dist/editor/model/enterCommands.js +288 -0
- package/dist/editor/model/extensionSyntaxWarnings.d.ts +29 -0
- package/dist/editor/model/extensionSyntaxWarnings.js +122 -0
- package/dist/editor/model/findBlockAtSourceOffset.d.ts +3 -0
- package/dist/editor/model/findBlockAtSourceOffset.js +20 -0
- package/dist/editor/model/fixtures/serialization-fidelity/reorder-gaps.svelte +4 -0
- package/dist/editor/model/focusOutcome.d.ts +25 -0
- package/dist/editor/model/focusOutcome.js +1 -0
- package/dist/editor/model/incrementalReparse.d.ts +16 -0
- package/dist/editor/model/incrementalReparse.js +111 -0
- package/dist/editor/model/index.d.ts +22 -0
- package/dist/editor/model/index.js +19 -0
- package/dist/editor/model/inlineDraftCommit.d.ts +17 -0
- package/dist/editor/model/inlineDraftCommit.js +187 -0
- package/dist/editor/model/inlineDraftMerge.d.ts +8 -0
- package/dist/editor/model/inlineDraftMerge.js +81 -0
- package/dist/editor/model/inlineEditCommands.d.ts +28 -0
- package/dist/editor/model/inlineEditCommands.js +581 -0
- package/dist/editor/model/inlinePlain.d.ts +3 -0
- package/dist/editor/model/inlinePlain.js +28 -0
- package/dist/editor/model/inlineSecondPass.d.ts +4 -0
- package/dist/editor/model/inlineSecondPass.js +47 -0
- package/dist/editor/model/line-utils.d.ts +14 -0
- package/dist/editor/model/line-utils.js +38 -0
- package/dist/editor/model/listEditCommands.d.ts +56 -0
- package/dist/editor/model/listEditCommands.js +299 -0
- package/dist/editor/model/nestedContainerTransactions.d.ts +36 -0
- package/dist/editor/model/nestedContainerTransactions.js +336 -0
- package/dist/editor/model/parseMarkdownDocument.d.ts +2 -0
- package/dist/editor/model/parseMarkdownDocument.js +324 -0
- package/dist/editor/model/quoteEditCommands.d.ts +39 -0
- package/dist/editor/model/quoteEditCommands.js +323 -0
- package/dist/editor/model/reconcileBlockIds.d.ts +9 -0
- package/dist/editor/model/reconcileBlockIds.js +297 -0
- package/dist/editor/model/reparseOptions.d.ts +12 -0
- package/dist/editor/model/reparseOptions.js +1 -0
- package/dist/editor/model/resolveEnterPlainSnapshot.d.ts +6 -0
- package/dist/editor/model/resolveEnterPlainSnapshot.js +23 -0
- package/dist/editor/model/richInlines.d.ts +16 -0
- package/dist/editor/model/richInlines.js +494 -0
- package/dist/editor/model/serializeInlineNodes.d.ts +3 -0
- package/dist/editor/model/serializeInlineNodes.js +45 -0
- package/dist/editor/model/serializeMarkdownDocument.d.ts +30 -0
- package/dist/editor/model/serializeMarkdownDocument.js +150 -0
- package/dist/editor/model/structureParseWarnings.d.ts +10 -0
- package/dist/editor/model/structureParseWarnings.js +60 -0
- package/dist/editor/model/syntheticInlineRanges.d.ts +3 -0
- package/dist/editor/model/syntheticInlineRanges.js +36 -0
- package/dist/editor/model/types.d.ts +185 -0
- package/dist/editor/model/types.js +26 -0
- package/dist/editor/plugins/autolinks/AutolinkRenderer.svelte +20 -0
- package/dist/editor/plugins/autolinks/AutolinkRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/autolinks/index.d.ts +2 -0
- package/dist/editor/plugins/autolinks/index.js +4 -0
- package/dist/editor/plugins/autolinks/parse-autolinks.d.ts +2 -0
- package/dist/editor/plugins/autolinks/parse-autolinks.js +68 -0
- package/dist/editor/plugins/autolinks/types.d.ts +6 -0
- package/dist/editor/plugins/autolinks/types.js +1 -0
- package/dist/editor/plugins/emphasis/EmphasisRenderer.svelte +15 -0
- package/dist/editor/plugins/emphasis/EmphasisRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/emphasis/index.d.ts +2 -0
- package/dist/editor/plugins/emphasis/index.js +4 -0
- package/dist/editor/plugins/emphasis/parse-emphasis.d.ts +2 -0
- package/dist/editor/plugins/emphasis/parse-emphasis.js +188 -0
- package/dist/editor/plugins/emphasis/types.d.ts +24 -0
- package/dist/editor/plugins/emphasis/types.js +1 -0
- package/dist/editor/plugins/escaping/EscapingRenderer.svelte +18 -0
- package/dist/editor/plugins/escaping/EscapingRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/escaping/index.d.ts +2 -0
- package/dist/editor/plugins/escaping/index.js +4 -0
- package/dist/editor/plugins/escaping/parse-escaping.d.ts +6 -0
- package/dist/editor/plugins/escaping/parse-escaping.js +26 -0
- package/dist/editor/plugins/escaping/types.d.ts +10 -0
- package/dist/editor/plugins/escaping/types.js +1 -0
- package/dist/editor/plugins/extended-task-list/ExtendedTaskListRenderer.svelte +25 -0
- package/dist/editor/plugins/extended-task-list/ExtendedTaskListRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/extended-task-list/index.d.ts +2 -0
- package/dist/editor/plugins/extended-task-list/index.js +4 -0
- package/dist/editor/plugins/extended-task-list/parse-extended-task-list.d.ts +2 -0
- package/dist/editor/plugins/extended-task-list/parse-extended-task-list.js +35 -0
- package/dist/editor/plugins/extended-task-list/types.d.ts +6 -0
- package/dist/editor/plugins/extended-task-list/types.js +1 -0
- package/dist/editor/plugins/highlight/HighlightRenderer.svelte +16 -0
- package/dist/editor/plugins/highlight/HighlightRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/highlight/index.d.ts +2 -0
- package/dist/editor/plugins/highlight/index.js +4 -0
- package/dist/editor/plugins/highlight/parse-highlights.d.ts +4 -0
- package/dist/editor/plugins/highlight/parse-highlights.js +49 -0
- package/dist/editor/plugins/highlight/types.d.ts +6 -0
- package/dist/editor/plugins/highlight/types.js +1 -0
- package/dist/editor/plugins/index.d.ts +1 -0
- package/dist/editor/plugins/index.js +1 -0
- package/dist/editor/plugins/links-images/LinksImagesRenderer.svelte +53 -0
- package/dist/editor/plugins/links-images/LinksImagesRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/links-images/index.d.ts +2 -0
- package/dist/editor/plugins/links-images/index.js +4 -0
- package/dist/editor/plugins/links-images/parse-image-layout.d.ts +28 -0
- package/dist/editor/plugins/links-images/parse-image-layout.js +147 -0
- package/dist/editor/plugins/links-images/parse-links-images.d.ts +25 -0
- package/dist/editor/plugins/links-images/parse-links-images.js +236 -0
- package/dist/editor/plugins/links-images/resolve-asset-url.d.ts +5 -0
- package/dist/editor/plugins/links-images/resolve-asset-url.js +21 -0
- package/dist/editor/plugins/links-images/types.d.ts +11 -0
- package/dist/editor/plugins/links-images/types.js +1 -0
- package/dist/editor/plugins/mention/MentionRenderer.svelte +18 -0
- package/dist/editor/plugins/mention/MentionRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/mention/index.d.ts +2 -0
- package/dist/editor/plugins/mention/index.js +4 -0
- package/dist/editor/plugins/mention/parse-mentions.d.ts +2 -0
- package/dist/editor/plugins/mention/parse-mentions.js +54 -0
- package/dist/editor/plugins/mention/types.d.ts +14 -0
- package/dist/editor/plugins/mention/types.js +1 -0
- package/dist/editor/plugins/raw-text/RawTextRenderer.svelte +19 -0
- package/dist/editor/plugins/raw-text/RawTextRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/raw-text/index.d.ts +2 -0
- package/dist/editor/plugins/raw-text/index.js +4 -0
- package/dist/editor/plugins/raw-text/types.d.ts +4 -0
- package/dist/editor/plugins/raw-text/types.js +1 -0
- package/dist/editor/plugins/shared/InlineNodes.svelte +113 -0
- package/dist/editor/plugins/shared/InlineNodes.svelte.d.ts +21 -0
- package/dist/editor/plugins/shared/InlineNodesEdit.svelte +78 -0
- package/dist/editor/plugins/shared/InlineNodesEdit.svelte.d.ts +21 -0
- package/dist/editor/plugins/strikethrough/StrikethroughRenderer.svelte +9 -0
- package/dist/editor/plugins/strikethrough/StrikethroughRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/strikethrough/index.d.ts +2 -0
- package/dist/editor/plugins/strikethrough/index.js +4 -0
- package/dist/editor/plugins/strikethrough/parse-strikethrough.d.ts +3 -0
- package/dist/editor/plugins/strikethrough/parse-strikethrough.js +38 -0
- package/dist/editor/plugins/strikethrough/types.d.ts +4 -0
- package/dist/editor/plugins/strikethrough/types.js +1 -0
- package/dist/editor/plugins/synced-block/SyncedBlockRenderer.svelte +16 -0
- package/dist/editor/plugins/synced-block/SyncedBlockRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/synced-block/index.d.ts +2 -0
- package/dist/editor/plugins/synced-block/index.js +4 -0
- package/dist/editor/plugins/synced-block/parse-synced-blocks.d.ts +2 -0
- package/dist/editor/plugins/synced-block/parse-synced-blocks.js +15 -0
- package/dist/editor/plugins/synced-block/types.d.ts +4 -0
- package/dist/editor/plugins/synced-block/types.js +1 -0
- package/dist/editor/plugins/types.d.ts +19 -0
- package/dist/editor/plugins/types.js +1 -0
- package/dist/editor/plugins/wiki-link/WikiLinkRenderer.svelte +15 -0
- package/dist/editor/plugins/wiki-link/WikiLinkRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/wiki-link/index.d.ts +2 -0
- package/dist/editor/plugins/wiki-link/index.js +4 -0
- package/dist/editor/plugins/wiki-link/parse-wiki-links.d.ts +2 -0
- package/dist/editor/plugins/wiki-link/parse-wiki-links.js +30 -0
- package/dist/editor/plugins/wiki-link/types.d.ts +8 -0
- package/dist/editor/plugins/wiki-link/types.js +1 -0
- package/dist/editor/taskCheckboxStates.d.ts +5 -0
- package/dist/editor/taskCheckboxStates.js +28 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/styles/index.css +6 -0
- package/package.json +84 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/** CM-style Unicode whitespace check; includes `\n` for simulated line-start boundary. */
|
|
2
|
+
const reUnicodeWhitespaceChar = /^[\f\n\r\t\v\u0020\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]/;
|
|
3
|
+
/** CM punctuation prefix check on a single code unit or surrogate pair. */
|
|
4
|
+
const rePunctuation = /^[\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,\-./:;<=>?@[\]^_`{|}~]/;
|
|
5
|
+
function isWhitespaceChar(c) {
|
|
6
|
+
return reUnicodeWhitespaceChar.test(c);
|
|
7
|
+
}
|
|
8
|
+
function isPunctuationChar(c) {
|
|
9
|
+
return rePunctuation.test(c);
|
|
10
|
+
}
|
|
11
|
+
function previousCharInLine(line, pos) {
|
|
12
|
+
if (pos === 0) {
|
|
13
|
+
return '\n';
|
|
14
|
+
}
|
|
15
|
+
const previousCc = line.charCodeAt(pos - 1);
|
|
16
|
+
if ((previousCc & 0xfc00) !== 0xdc00) {
|
|
17
|
+
return line.charAt(pos - 1);
|
|
18
|
+
}
|
|
19
|
+
const twoPreviousCc = line.charCodeAt(pos - 2);
|
|
20
|
+
if ((twoPreviousCc & 0xfc00) !== 0xd800) {
|
|
21
|
+
return line.charAt(pos - 1);
|
|
22
|
+
}
|
|
23
|
+
return line.slice(pos - 2, pos);
|
|
24
|
+
}
|
|
25
|
+
function scanDelims(line, startpos) {
|
|
26
|
+
let numdelims = 0;
|
|
27
|
+
let i = startpos;
|
|
28
|
+
while (i < line.length && line.charCodeAt(i) === 0x2a /* * */) {
|
|
29
|
+
numdelims++;
|
|
30
|
+
i++;
|
|
31
|
+
}
|
|
32
|
+
if (numdelims === 0) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const charBefore = previousCharInLine(line, startpos);
|
|
36
|
+
const charAfter = i >= line.length ? '\n' : line.charAt(i);
|
|
37
|
+
const afterIsWhitespace = isWhitespaceChar(charAfter);
|
|
38
|
+
const afterIsPunctuation = isPunctuationChar(charAfter);
|
|
39
|
+
const beforeIsWhitespace = isWhitespaceChar(charBefore);
|
|
40
|
+
const beforeIsPunctuation = isPunctuationChar(charBefore);
|
|
41
|
+
const leftFlanking = !afterIsWhitespace && (!afterIsPunctuation || beforeIsWhitespace || beforeIsPunctuation);
|
|
42
|
+
const rightFlanking = !beforeIsWhitespace && (!beforeIsPunctuation || afterIsWhitespace || afterIsPunctuation);
|
|
43
|
+
return { numdelims, canOpen: leftFlanking, canClose: rightFlanking };
|
|
44
|
+
}
|
|
45
|
+
function removeDelimiter(head, delim) {
|
|
46
|
+
if (delim.previous !== null) {
|
|
47
|
+
delim.previous.next = delim.next;
|
|
48
|
+
}
|
|
49
|
+
if (delim.next === null) {
|
|
50
|
+
head = delim.previous;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
delim.next.previous = delim.previous;
|
|
54
|
+
}
|
|
55
|
+
return head;
|
|
56
|
+
}
|
|
57
|
+
function removeDelimitersBetween(bottom, top) {
|
|
58
|
+
if (bottom.next !== top) {
|
|
59
|
+
bottom.next = top;
|
|
60
|
+
top.previous = bottom;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function processLineDelimiters(line, lineBase, lineIndex, headIn, spans) {
|
|
64
|
+
let head = headIn;
|
|
65
|
+
const stackBottom = null;
|
|
66
|
+
let closer = head;
|
|
67
|
+
while (closer !== null && closer.previous !== stackBottom) {
|
|
68
|
+
closer = closer.previous;
|
|
69
|
+
}
|
|
70
|
+
const openersBottom = Array.from({ length: 14 }, () => stackBottom);
|
|
71
|
+
while (closer !== null) {
|
|
72
|
+
if (!closer.canClose) {
|
|
73
|
+
closer = closer.next;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
let opener = closer.previous;
|
|
77
|
+
let openerFound = false;
|
|
78
|
+
const openersBottomIndex = 8 + (closer.canOpen ? 3 : 0) + (closer.origdelims % 3);
|
|
79
|
+
while (opener !== null &&
|
|
80
|
+
opener !== stackBottom &&
|
|
81
|
+
opener !== openersBottom[openersBottomIndex]) {
|
|
82
|
+
const oddMatch = (closer.canOpen || opener.canClose) &&
|
|
83
|
+
closer.origdelims % 3 !== 0 &&
|
|
84
|
+
(opener.origdelims + closer.origdelims) % 3 === 0;
|
|
85
|
+
if (opener.cc === closer.cc && opener.canOpen && !oddMatch) {
|
|
86
|
+
openerFound = true;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
opener = opener.previous;
|
|
90
|
+
}
|
|
91
|
+
const oldCloser = closer;
|
|
92
|
+
if (!openerFound) {
|
|
93
|
+
closer = closer.next;
|
|
94
|
+
openersBottom[openersBottomIndex] = oldCloser.previous;
|
|
95
|
+
if (!oldCloser.canOpen) {
|
|
96
|
+
head = removeDelimiter(head, oldCloser);
|
|
97
|
+
}
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const openerDelim = opener;
|
|
101
|
+
const useDelims = closer.numdelims >= 2 && openerDelim.numdelims >= 2 ? 2 : 1;
|
|
102
|
+
const kind = useDelims === 1 ? 'emphasis' : 'strong';
|
|
103
|
+
const openerRunEnd = openerDelim.start + openerDelim.numdelims;
|
|
104
|
+
const closerConsumedStart = closer.start + closer.numdelims - useDelims;
|
|
105
|
+
const innerText = line.slice(openerRunEnd, closerConsumedStart);
|
|
106
|
+
const openConsumedStart = openerRunEnd - useDelims;
|
|
107
|
+
spans.push({
|
|
108
|
+
lineIndex,
|
|
109
|
+
startOffset: lineBase + openConsumedStart,
|
|
110
|
+
endOffset: lineBase + closer.start + closer.numdelims,
|
|
111
|
+
kind,
|
|
112
|
+
text: innerText
|
|
113
|
+
});
|
|
114
|
+
openerDelim.numdelims -= useDelims;
|
|
115
|
+
closer.numdelims -= useDelims;
|
|
116
|
+
removeDelimitersBetween(openerDelim, closer);
|
|
117
|
+
if (openerDelim.numdelims === 0) {
|
|
118
|
+
head = removeDelimiter(head, openerDelim);
|
|
119
|
+
}
|
|
120
|
+
if (closer.numdelims === 0) {
|
|
121
|
+
const tempstack = closer.next;
|
|
122
|
+
head = removeDelimiter(head, closer);
|
|
123
|
+
closer = tempstack;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
closer = closer.next;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
while (head !== null && head !== stackBottom) {
|
|
130
|
+
head = removeDelimiter(head, head);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export function parseEmphasis(source) {
|
|
134
|
+
const spans = [];
|
|
135
|
+
let lineStart = 0;
|
|
136
|
+
let lineIndex = 0;
|
|
137
|
+
while (lineStart <= source.length) {
|
|
138
|
+
const nl = source.indexOf('\n', lineStart);
|
|
139
|
+
const lineEnd = nl === -1 ? source.length : nl;
|
|
140
|
+
let line = source.slice(lineStart, lineEnd);
|
|
141
|
+
if (line.endsWith('\r')) {
|
|
142
|
+
line = line.slice(0, -1);
|
|
143
|
+
}
|
|
144
|
+
const lineBase = lineStart;
|
|
145
|
+
let head = null;
|
|
146
|
+
let i = 0;
|
|
147
|
+
while (i < line.length) {
|
|
148
|
+
const c = line.charCodeAt(i);
|
|
149
|
+
if (c === 0x5c /* \\ */ && i + 1 < line.length) {
|
|
150
|
+
i += 2;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (c === 0x2a) {
|
|
154
|
+
const start = i;
|
|
155
|
+
const scanned = scanDelims(line, start);
|
|
156
|
+
if (!scanned) {
|
|
157
|
+
i++;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
i = start + scanned.numdelims;
|
|
161
|
+
if (scanned.canOpen || scanned.canClose) {
|
|
162
|
+
const delim = {
|
|
163
|
+
cc: 0x2a,
|
|
164
|
+
numdelims: scanned.numdelims,
|
|
165
|
+
origdelims: scanned.numdelims,
|
|
166
|
+
start,
|
|
167
|
+
canOpen: scanned.canOpen,
|
|
168
|
+
canClose: scanned.canClose,
|
|
169
|
+
previous: head,
|
|
170
|
+
next: null
|
|
171
|
+
};
|
|
172
|
+
if (head !== null) {
|
|
173
|
+
head.next = delim;
|
|
174
|
+
}
|
|
175
|
+
head = delim;
|
|
176
|
+
}
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
i++;
|
|
180
|
+
}
|
|
181
|
+
processLineDelimiters(line, lineBase, lineIndex, head, spans);
|
|
182
|
+
if (nl === -1)
|
|
183
|
+
break;
|
|
184
|
+
lineStart = nl + 1;
|
|
185
|
+
lineIndex++;
|
|
186
|
+
}
|
|
187
|
+
return spans;
|
|
188
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline emphasis blocks come from a **per-line** CommonMark-style `*` delimiter
|
|
3
|
+
* pass (see `parse-emphasis.ts`). Emphasis cannot span newlines.
|
|
4
|
+
*
|
|
5
|
+
* Each block is one successful delimiter pair after stack processing:
|
|
6
|
+
* - `use_delims === 1` → `emphasis` (italic)
|
|
7
|
+
* - `use_delims === 2` → `strong` (bold)
|
|
8
|
+
*
|
|
9
|
+
* A single author span like `***text***` is typically split into nested pairs by
|
|
10
|
+
* the same rules as CommonMark, so it may yield **two** blocks (overlapping
|
|
11
|
+
* ranges) rather than one combined record.
|
|
12
|
+
*/
|
|
13
|
+
export type EmphasisKind = 'emphasis' | 'strong';
|
|
14
|
+
export type EmphasisBlock = {
|
|
15
|
+
/** 0-based index of the line containing this span (no cross-line spans). */
|
|
16
|
+
lineIndex: number;
|
|
17
|
+
/** Inclusive start offset in the full document `source`. */
|
|
18
|
+
startOffset: number;
|
|
19
|
+
/** Exclusive end offset in the full document `source`. */
|
|
20
|
+
endOffset: number;
|
|
21
|
+
kind: EmphasisKind;
|
|
22
|
+
/** Inner text only; does not include the delimiter asterisks. */
|
|
23
|
+
text: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { EscapingBlock } from './types';
|
|
3
|
+
|
|
4
|
+
export { escapingRenderer };
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
{#snippet escapingRenderer(block: EscapingBlock)}
|
|
8
|
+
<article class="mb-4 border-l border-semantic-warning/50 pl-3 font-mono text-sm text-semantic-warning/95">
|
|
9
|
+
<p class="mb-1 text-[11px] font-medium tracking-wide text-semantic-warning/90 uppercase">
|
|
10
|
+
Escape · L{block.lineIndex + 1}:{block.column + 1}
|
|
11
|
+
</p>
|
|
12
|
+
<p class="tabular-nums">
|
|
13
|
+
<code class="text-option-yellow">{block.raw}</code>
|
|
14
|
+
<span class="mx-2 text-txt-tertiary">→</span>
|
|
15
|
+
<span class="text-txt-primary">{block.literal}</span>
|
|
16
|
+
</p>
|
|
17
|
+
</article>
|
|
18
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EscapingBlock } from './types';
|
|
2
|
+
declare const escapingRenderer: (block: EscapingBlock) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { escapingRenderer };
|
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
14
|
+
};
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
16
|
+
}
|
|
17
|
+
declare const EscapingRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type EscapingRenderer = InstanceType<typeof EscapingRenderer>;
|
|
21
|
+
export default EscapingRenderer;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EscapingBlock } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Escaping (md-spec): backslash prefixes a literal for special characters (e.g. `\*`, `\#`, `` \` ``).
|
|
4
|
+
* Records each `\x` pair in source order; trailing `\` with no following character is skipped.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseEscapes(source: string): EscapingBlock[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escaping (md-spec): backslash prefixes a literal for special characters (e.g. `\*`, `\#`, `` \` ``).
|
|
3
|
+
* Records each `\x` pair in source order; trailing `\` with no following character is skipped.
|
|
4
|
+
*/
|
|
5
|
+
export function parseEscapes(source) {
|
|
6
|
+
const lines = source.split(/\r?\n/);
|
|
7
|
+
const out = [];
|
|
8
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
9
|
+
const line = lines[lineIndex];
|
|
10
|
+
for (let i = 0; i < line.length; i++) {
|
|
11
|
+
if (line[i] !== '\\')
|
|
12
|
+
continue;
|
|
13
|
+
const next = line[i + 1];
|
|
14
|
+
if (next === undefined)
|
|
15
|
+
break;
|
|
16
|
+
out.push({
|
|
17
|
+
lineIndex,
|
|
18
|
+
column: i,
|
|
19
|
+
raw: `\\${next}`,
|
|
20
|
+
literal: next
|
|
21
|
+
});
|
|
22
|
+
i++;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type EscapingBlock = {
|
|
2
|
+
/** 0-based line in the source (split on `\r?\n`) */
|
|
3
|
+
lineIndex: number;
|
|
4
|
+
/** 0-based column where the backslash starts */
|
|
5
|
+
column: number;
|
|
6
|
+
/** The two-char source span: backslash + escaped code unit */
|
|
7
|
+
raw: string;
|
|
8
|
+
/** The character (code unit) produced after escaping */
|
|
9
|
+
literal: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { ExtendedTaskListBlock } from './types';
|
|
3
|
+
|
|
4
|
+
const boxClass =
|
|
5
|
+
'inline-flex min-h-[1.25rem] min-w-[1.25rem] shrink-0 items-center justify-center border border-border-emphasis font-mono text-[10px] leading-none text-txt-secondary';
|
|
6
|
+
|
|
7
|
+
const rowClass = 'flex items-start gap-2 text-sm text-txt-primary';
|
|
8
|
+
|
|
9
|
+
export { extendedTaskListRenderer };
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#snippet extendedTaskListRenderer(block: ExtendedTaskListBlock)}
|
|
13
|
+
<div class={`${rowClass} mb-3`}>
|
|
14
|
+
{#if block.state === 'todo'}
|
|
15
|
+
<span class={boxClass} aria-hidden="true"> </span>
|
|
16
|
+
{:else if block.state === 'done'}
|
|
17
|
+
<span class={boxClass} aria-hidden="true">✓</span>
|
|
18
|
+
{:else if block.state === 'in_progress'}
|
|
19
|
+
<span class={boxClass} aria-hidden="true">/</span>
|
|
20
|
+
{:else}
|
|
21
|
+
<span class={boxClass} aria-hidden="true">></span>
|
|
22
|
+
{/if}
|
|
23
|
+
<span class="min-w-0 pt-0.5">{block.label}</span>
|
|
24
|
+
</div>
|
|
25
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ExtendedTaskListBlock } from './types';
|
|
2
|
+
declare const extendedTaskListRenderer: (block: ExtendedTaskListBlock) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { extendedTaskListRenderer };
|
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
14
|
+
};
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
16
|
+
}
|
|
17
|
+
declare const ExtendedTaskListRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type ExtendedTaskListRenderer = InstanceType<typeof ExtendedTaskListRenderer>;
|
|
21
|
+
export default ExtendedTaskListRenderer;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** `- [ ]`, `- [x]`, `- [/]`, `- [>]`: optional indent, hyphen bullet, bracket marker. */
|
|
2
|
+
const EXTENDED_TASK_LINE = /^(\s*)-\s+\[([ xX/>])\]\s*(.*)$/;
|
|
3
|
+
function markerToState(marker) {
|
|
4
|
+
switch (marker) {
|
|
5
|
+
case ' ':
|
|
6
|
+
return 'todo';
|
|
7
|
+
case 'x':
|
|
8
|
+
case 'X':
|
|
9
|
+
return 'done';
|
|
10
|
+
case '/':
|
|
11
|
+
return 'in_progress';
|
|
12
|
+
case '>':
|
|
13
|
+
return 'deferred';
|
|
14
|
+
default:
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function parseExtendedTaskList(source) {
|
|
19
|
+
const lines = source.split(/\r?\n/);
|
|
20
|
+
const out = [];
|
|
21
|
+
for (let i = 0; i < lines.length; i++) {
|
|
22
|
+
const match = lines[i].match(EXTENDED_TASK_LINE);
|
|
23
|
+
if (!match)
|
|
24
|
+
continue;
|
|
25
|
+
const state = markerToState(match[2]);
|
|
26
|
+
if (!state)
|
|
27
|
+
continue;
|
|
28
|
+
out.push({
|
|
29
|
+
state,
|
|
30
|
+
label: match[3].trimEnd(),
|
|
31
|
+
lineIndex: i
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { HighlightBlock } from './types';
|
|
3
|
+
|
|
4
|
+
const defaultMarkClass = 'rounded px-0.5 decoration-clone bg-option-yellow/35 text-txt-primary';
|
|
5
|
+
|
|
6
|
+
export { highlightRenderer };
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
{#snippet highlightRenderer(block: HighlightBlock)}
|
|
10
|
+
<mark
|
|
11
|
+
class={block.color ? 'rounded px-0.5 text-txt-primary' : defaultMarkClass}
|
|
12
|
+
style={block.color ? `background-color: ${block.color}` : undefined}
|
|
13
|
+
>
|
|
14
|
+
{block.text}
|
|
15
|
+
</mark>
|
|
16
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HighlightBlock } from './types';
|
|
2
|
+
declare const highlightRenderer: (block: HighlightBlock) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { highlightRenderer };
|
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
14
|
+
};
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
16
|
+
}
|
|
17
|
+
declare const HighlightRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type HighlightRenderer = InstanceType<typeof HighlightRenderer>;
|
|
21
|
+
export default HighlightRenderer;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HighlightBlock } from './types';
|
|
2
|
+
/** Allows safe `background-color` values from user tokens (no `;`, quotes, or `url()`). */
|
|
3
|
+
export declare function isSafeCssColorToken(token: string): boolean;
|
|
4
|
+
export declare function parseHighlights(source: string): HighlightBlock[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Allows safe `background-color` values from user tokens (no `;`, quotes, or `url()`). */
|
|
2
|
+
export function isSafeCssColorToken(token) {
|
|
3
|
+
const t = token.trim();
|
|
4
|
+
if (!t)
|
|
5
|
+
return false;
|
|
6
|
+
if (/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(t))
|
|
7
|
+
return true;
|
|
8
|
+
if (/^[a-zA-Z][a-zA-Z0-9_-]{0,39}$/.test(t))
|
|
9
|
+
return true;
|
|
10
|
+
if (/^rgba?\(\s*[\d.%\s,]+\s*\)$/.test(t))
|
|
11
|
+
return true;
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
export function parseHighlights(source) {
|
|
15
|
+
const out = [];
|
|
16
|
+
let i = 0;
|
|
17
|
+
while (i < source.length) {
|
|
18
|
+
const open = source.indexOf('==', i);
|
|
19
|
+
if (open === -1)
|
|
20
|
+
break;
|
|
21
|
+
const close = source.indexOf('==', open + 2);
|
|
22
|
+
if (close === -1)
|
|
23
|
+
break;
|
|
24
|
+
const inner = source.slice(open + 2, close);
|
|
25
|
+
const colonIdx = inner.indexOf(':');
|
|
26
|
+
let color = null;
|
|
27
|
+
let text;
|
|
28
|
+
if (colonIdx !== -1) {
|
|
29
|
+
const rawColor = inner.slice(0, colonIdx).trim();
|
|
30
|
+
const afterColon = inner.slice(colonIdx + 1);
|
|
31
|
+
if (rawColor !== '' && isSafeCssColorToken(rawColor)) {
|
|
32
|
+
color = rawColor;
|
|
33
|
+
text = afterColon;
|
|
34
|
+
}
|
|
35
|
+
else if (rawColor === '') {
|
|
36
|
+
text = afterColon;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
text = inner;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
text = inner;
|
|
44
|
+
}
|
|
45
|
+
out.push({ color, text, startOffset: open });
|
|
46
|
+
i = close + 2;
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { AnyEditorRenderBlock, BlockRenderAdapter, EditorRenderBlock, MarkdownDocument } from './types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { LinkImageBlock } from './types';
|
|
3
|
+
import { hrefForDisplay } from '../../context/assetBaseUrl.js';
|
|
4
|
+
import { imageLayoutCss, parseImageLabelLayout } from './parse-image-layout.js';
|
|
5
|
+
|
|
6
|
+
/* eslint-disable svelte/no-navigation-without-resolve -- MD link destinations are author-controlled, not Kit routes */
|
|
7
|
+
|
|
8
|
+
function isAbsoluteHttpHref(href: string): boolean {
|
|
9
|
+
return /^https?:\/\//iu.test(href.trim());
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { linksImagesRenderer };
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
{#snippet linksImagesRenderer(block: LinkImageBlock)}
|
|
16
|
+
{@const href = block.href ? hrefForDisplay(block.href) : null}
|
|
17
|
+
<div class="mb-4 text-sm">
|
|
18
|
+
{#if block.kind === 'image'}
|
|
19
|
+
{@const layout = parseImageLabelLayout(block.label)}
|
|
20
|
+
{@const css = imageLayoutCss(layout.displayWidth, layout.floatAlign)}
|
|
21
|
+
{#if href}
|
|
22
|
+
<span class="ph-image-layout {css.wrapperClass}">
|
|
23
|
+
<img
|
|
24
|
+
src={href}
|
|
25
|
+
alt={layout.malformedSuffix ? block.label : layout.alt}
|
|
26
|
+
title={block.title ?? undefined}
|
|
27
|
+
class={css.imgClass}
|
|
28
|
+
style={css.imgStyle}
|
|
29
|
+
loading="lazy"
|
|
30
|
+
decoding="async"
|
|
31
|
+
referrerpolicy="no-referrer"
|
|
32
|
+
/>
|
|
33
|
+
</span>
|
|
34
|
+
{:else}
|
|
35
|
+
<span class="text-txt-secondary italic">{block.label || 'Image'}</span>
|
|
36
|
+
<span class="text-txt-tertiary"> (blocked or invalid URL)</span>
|
|
37
|
+
{/if}
|
|
38
|
+
{:else if href}
|
|
39
|
+
<a
|
|
40
|
+
href={href}
|
|
41
|
+
title={block.title ?? undefined}
|
|
42
|
+
class="font-medium text-accent-primary underline decoration-accent-primary/50 underline-offset-2 hover:text-accent-secondary hover:decoration-accent-secondary"
|
|
43
|
+
target={isAbsoluteHttpHref(href) ? '_blank' : undefined}
|
|
44
|
+
rel={isAbsoluteHttpHref(href) ? 'noopener noreferrer' : undefined}
|
|
45
|
+
>
|
|
46
|
+
{block.label || block.href}
|
|
47
|
+
</a>
|
|
48
|
+
{:else}
|
|
49
|
+
<span class="text-txt-secondary">{block.label}</span>
|
|
50
|
+
<span class="text-txt-tertiary"> (blocked or invalid URL)</span>
|
|
51
|
+
{/if}
|
|
52
|
+
</div>
|
|
53
|
+
{/snippet}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LinkImageBlock } from './types';
|
|
2
|
+
declare const linksImagesRenderer: (block: LinkImageBlock) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
export { linksImagesRenderer };
|
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
14
|
+
};
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
16
|
+
}
|
|
17
|
+
declare const LinksImagesRenderer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type LinksImagesRenderer = InstanceType<typeof LinksImagesRenderer>;
|
|
21
|
+
export default LinksImagesRenderer;
|