@mdsvex/parse 1.0.0-next.0 → 1.0.0-next.1
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/CHANGELOG.md +213 -0
- package/WIRE_FORMAT.md +5 -1
- package/dist/buf-utils.js +23 -23
- package/dist/buf_utils.d.ts +1 -1
- package/dist/cursor.d.ts +17 -13
- package/dist/cursor.js +118 -31
- package/dist/main.d.ts +362 -26
- package/dist/main.js +5841 -3420
- package/dist/node_view-bvM0i0-p.js +407 -0
- package/dist/node_view.d.ts +11 -12
- package/dist/opcodes.d.ts +23 -6
- package/dist/plugin_dispatch.d.ts +22 -8
- package/dist/tree-builder.js +185 -66
- package/dist/tree_builder.d.ts +42 -11
- package/dist/undo_log.d.ts +11 -1
- package/dist/utils.d.ts +77 -51
- package/dist/utils.js +687 -209
- package/dist/wire-tree-builder.js +69 -71
- package/dist/wire_tree_builder.d.ts +4 -7
- package/package.json +1 -1
- package/src/buf_utils.ts +10 -14
- package/src/cursor.ts +74 -57
- package/src/main.ts +9898 -5593
- package/src/node_view.ts +159 -140
- package/src/opcodes.ts +39 -7
- package/src/plugin_dispatch.ts +328 -219
- package/src/tree_builder.ts +278 -98
- package/src/undo_log.ts +58 -24
- package/src/utils.spec.ts +86 -9
- package/src/utils.ts +769 -392
- package/src/wire_emitter.ts +6 -0
- package/src/wire_tree_builder.ts +39 -52
- package/test/block_quotes.spec.ts +78 -7
- package/test/code_spans.spec.ts +158 -6
- package/test/crlf.spec.ts +49 -1
- package/test/directives.spec.ts +530 -1
- package/test/emphasis.spec.ts +10 -4
- package/test/fixtures/pfm/block_quotes/pfm_fence_close.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_compact.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_end_quote.md +5 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_info.md +5 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_longer.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_nested.md +3 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_twice.md +6 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_info_eof.md +1 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_unclosed.md +2 -0
- package/test/fixtures/pfm/code_spans/pfm_328_5.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_6.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_7.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_8.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_9.md +2 -0
- package/test/fixtures/pfm/fenced_code_blocks/pfm_info_eof.md +1 -0
- package/test/fixtures/pfm/fenced_code_blocks/pfm_info_eof_no_lf.md +1 -0
- package/test/fixtures/pfm/generic_directives/106.md +1 -0
- package/test/fixtures/pfm/generic_directives/107.md +3 -0
- package/test/fixtures/pfm/generic_directives/108.md +1 -0
- package/test/fixtures/pfm/generic_directives/109.md +1 -0
- package/test/fixtures/pfm/generic_directives/110.md +1 -0
- package/test/fixtures/pfm/generic_directives/111.md +1 -0
- package/test/fixtures/pfm/generic_directives/112.md +1 -0
- package/test/fixtures/pfm/generic_directives/113.md +1 -0
- package/test/fixtures/pfm/generic_directives/114.md +2 -0
- package/test/fixtures/pfm/generic_directives/115.md +1 -0
- package/test/fixtures/pfm/generic_directives/116.md +6 -0
- package/test/fixtures/pfm/generic_directives/117.md +3 -0
- package/test/fixtures/pfm/generic_directives/118.md +6 -0
- package/test/fixtures/pfm/generic_directives/119.md +3 -0
- package/test/fixtures/pfm/generic_directives/120.md +5 -0
- package/test/fixtures/pfm/generic_directives/121.md +3 -0
- package/test/fixtures/pfm/generic_directives/122.md +4 -0
- package/test/fixtures/pfm/generic_directives/123.md +2 -0
- package/test/html.spec.ts +44 -1
- package/test/html_block_containers.spec.ts +445 -0
- package/test/incremental.spec.ts +271 -0
- package/test/lists.spec.ts +107 -1
- package/test/parser_reuse.spec.ts +40 -0
- package/test/plugins.spec.ts +196 -226
- package/test/print.ts +2 -3
- package/test/run_bytecode.spec.ts +36 -0
- package/test/snapshots/hybrid/component-children.snap.ast +9 -16
- package/test/snapshots/hybrid/component-simple-00.snap.ast +1 -2
- package/test/snapshots/hybrid/component-simple-01.snap.ast +1 -2
- package/test/snapshots/hybrid/component-simple-03.snap.ast +13 -13
- package/test/snapshots/hybrid/component-simple-04.snap.ast +1 -2
- package/test/snapshots/hybrid/error.snap.ast +1 -2
- package/test/snapshots/markdown/blockquote-nested-markdown.snap.ast +2 -1
- package/test/snapshots/markdown/emphasis.snap.ast +2 -2
- package/test/snapshots/markdown/encodeHTMLCodeTags.snap.ast +1 -2
- package/test/snapshots/markdown/github-style-codeblock-inside-quote.snap.ast +8 -1
- package/test/snapshots/markdown/html-comments.snap.ast +11 -13
- package/test/snapshots/markdown/html5-strutural-tags.snap.ast +16 -31
- package/test/snapshots/markdown/line-starts-with-html.snap.ast +5 -6
- package/test/snapshots/markdown/literal-html-tags.snap.ast +11 -14
- package/test/snapshots/markdown/nested-blockquote.snap.ast +3 -3
- package/test/snapshots/markdown/pre-code-tags.snap.ast +5 -8
- package/test/snapshots/pfm/block_quotes/237.snap.ast +1 -2
- package/test/snapshots/pfm/block_quotes/251.snap.ast +5 -5
- package/test/snapshots/pfm/block_quotes/pfm_fence_close.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_compact.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_end_quote.snap.ast +8 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_info.snap.ast +4 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_longer.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_nested.snap.ast +5 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_twice.snap.ast +5 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_info_eof.snap.ast +3 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_unclosed.snap.ast +3 -0
- package/test/snapshots/pfm/code_spans/344.snap.ast +1 -1
- package/test/snapshots/pfm/code_spans/347.snap.ast +1 -2
- package/test/snapshots/pfm/code_spans/pfm_328_5.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_6.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_7.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_8.snap.ast +8 -0
- package/test/snapshots/pfm/code_spans/pfm_328_9.snap.ast +10 -0
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/417.snap.ast +2 -2
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/438.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/441.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/444.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/445.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/450.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/453.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/456.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/457.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/473.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/475.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/476.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/477.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/478.snap.ast +3 -4
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/479.snap.ast +3 -4
- package/test/snapshots/pfm/fenced_code_blocks/126.snap.ast +1 -2
- package/test/snapshots/pfm/fenced_code_blocks/pfm_info_eof.snap.ast +2 -0
- package/test/snapshots/pfm/fenced_code_blocks/pfm_info_eof_no_lf.snap.ast +2 -0
- package/test/snapshots/pfm/generic_directives/011.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/015.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/016.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/017.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/019.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/020.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/030.snap.ast +4 -6
- package/test/snapshots/pfm/generic_directives/034.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/036.snap.ast +5 -1
- package/test/snapshots/pfm/generic_directives/038.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/039.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/040.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/044.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/046.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/089.snap.ast +1 -1
- package/test/snapshots/pfm/generic_directives/103.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/106.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/107.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/108.snap.ast +5 -0
- package/test/snapshots/pfm/generic_directives/109.snap.ast +4 -0
- package/test/snapshots/pfm/generic_directives/110.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/111.snap.ast +7 -0
- package/test/snapshots/pfm/generic_directives/112.snap.ast +18 -0
- package/test/snapshots/pfm/generic_directives/113.snap.ast +7 -0
- package/test/snapshots/pfm/generic_directives/114.snap.ast +12 -0
- package/test/snapshots/pfm/generic_directives/115.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/116.snap.ast +13 -0
- package/test/snapshots/pfm/generic_directives/117.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/118.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/119.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/120.snap.ast +12 -0
- package/test/snapshots/pfm/generic_directives/121.snap.ast +3 -0
- package/test/snapshots/pfm/generic_directives/122.snap.ast +3 -0
- package/test/snapshots/pfm/generic_directives/123.snap.ast +3 -0
- package/test/snapshots/pfm/hard_line_breaks/642.snap.ast +1 -1
- package/test/snapshots/pfm/hard_line_breaks/643.snap.ast +1 -1
- package/test/snapshots/pfm/html/148.snap.ast +1 -1
- package/test/snapshots/pfm/html/150.snap.ast +1 -1
- package/test/snapshots/pfm/html/159.snap.ast +2 -3
- package/test/snapshots/pfm/html/162.snap.ast +3 -4
- package/test/snapshots/pfm/html/163.snap.ast +1 -1
- package/test/snapshots/pfm/html/164.snap.ast +3 -4
- package/test/snapshots/pfm/html/166.snap.ast +1 -1
- package/test/snapshots/pfm/html/168.snap.ast +2 -3
- package/test/snapshots/pfm/html/169.snap.ast +5 -7
- package/test/snapshots/pfm/html/174.snap.ast +3 -3
- package/test/snapshots/pfm/html/182.snap.ast +1 -1
- package/test/snapshots/pfm/html/613.snap.ast +2 -2
- package/test/snapshots/pfm/html/615.snap.ast +2 -2
- package/test/snapshots/pfm/images/585.snap.ast +1 -1
- package/test/snapshots/pfm/images/589.snap.ast +1 -1
- package/test/snapshots/pfm/link_reference_definitions/201.snap.ast +1 -1
- package/test/snapshots/pfm/link_reference_definitions/208.snap.ast +1 -1
- package/test/snapshots/pfm/links/491.snap.ast +1 -1
- package/test/snapshots/pfm/links/494.snap.ast +2 -2
- package/test/snapshots/pfm/links/516.snap.ast +8 -9
- package/test/snapshots/pfm/links/521.snap.ast +1 -1
- package/test/snapshots/pfm/links/530.snap.ast +8 -12
- package/test/snapshots/pfm/links/534.snap.ast +1 -1
- package/test/snapshots/pfm/links/552.snap.ast +2 -2
- package/test/snapshots/pfm/links/559.snap.ast +1 -1
- package/test/snapshots/pfm/links/564.snap.ast +1 -1
- package/test/snapshots/pfm/list_items/260.snap.ast +3 -4
- package/test/snapshots/pfm/list_items/293.snap.ast +2 -2
- package/test/snapshots/pfm/tabs/16.snap.ast +2 -3
- package/test/snapshots/pfm/tabs/4.snap.ast +6 -5
- package/test/snapshots/svelte/00-introduction/00-hello-world/App.snap.ast +3 -4
- package/test/snapshots/svelte/00-introduction/02-styling/App.snap.ast +2 -3
- package/test/snapshots/svelte/00-introduction/03-nested-components/App.snap.ast +2 -3
- package/test/snapshots/svelte/00-introduction/03-nested-components/Nested.snap.ast +1 -2
- package/test/snapshots/svelte/00-introduction/04-html-tags/App.snap.ast +1 -2
- package/test/snapshots/svelte/01-reactivity/00-reactive-assignments/App.snap.ast +5 -6
- package/test/snapshots/svelte/01-reactivity/01-reactive-declarations/App.snap.ast +11 -14
- package/test/snapshots/svelte/01-reactivity/02-reactive-statements/App.snap.ast +5 -6
- package/test/snapshots/svelte/02-props/00-declaring-props/Nested.snap.ast +2 -3
- package/test/snapshots/svelte/02-props/01-default-values/App.snap.ast +1 -1
- package/test/snapshots/svelte/02-props/01-default-values/Nested.snap.ast +2 -3
- package/test/snapshots/svelte/02-props/02-spread-props/Info.snap.ast +16 -17
- package/test/snapshots/svelte/03-logic/00-if-blocks/App.snap.ast +4 -8
- package/test/snapshots/svelte/03-logic/01-else-blocks/App.snap.ast +4 -8
- package/test/snapshots/svelte/03-logic/02-else-if-blocks/App.snap.ast +6 -9
- package/test/snapshots/svelte/03-logic/03-each-blocks/App.snap.ast +5 -8
- package/test/snapshots/svelte/03-logic/04-keyed-each-blocks/App.snap.ast +4 -7
- package/test/snapshots/svelte/03-logic/04-keyed-each-blocks/Thing.snap.ast +4 -5
- package/test/snapshots/svelte/04-events/02-event-modifiers/App.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/03-component-events/Inner.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/04-event-forwarding/Inner.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/05-dom-event-forwarding/FancyButton.snap.ast +2 -3
- package/test/snapshots/svelte/05-bindings/00-text-inputs/App.snap.ast +3 -4
- package/test/snapshots/svelte/05-bindings/01-numeric-inputs/App.snap.ast +9 -8
- package/test/snapshots/svelte/05-bindings/02-checkbox-inputs/App.snap.ast +7 -11
- package/test/snapshots/svelte/05-bindings/03-group-inputs/App.snap.ast +21 -30
- package/test/snapshots/svelte/05-bindings/04-textarea-inputs/App.snap.ast +1 -2
- package/test/snapshots/svelte/05-bindings/05-select-bindings/App.snap.ast +5 -9
- package/test/snapshots/svelte/05-bindings/06-multiple-select-bindings/App.snap.ast +18 -26
- package/test/snapshots/svelte/05-bindings/07-each-block-bindings/App.snap.ast +7 -11
- package/test/snapshots/svelte/05-bindings/08-media-elements/App.snap.ast +15 -19
- package/test/snapshots/svelte/05-bindings/09-dimensions/App.snap.ast +7 -9
- package/test/snapshots/svelte/05-bindings/11-component-bindings/App.snap.ast +1 -2
- package/test/snapshots/svelte/05-bindings/11-component-bindings/Keypad.snap.ast +32 -34
- package/test/snapshots/svelte/06-lifecycle/00-onmount/App.snap.ast +3 -6
- package/test/snapshots/svelte/06-lifecycle/01-ondestroy/App.snap.ast +6 -7
- package/test/snapshots/svelte/06-lifecycle/02-update/App.snap.ast +2 -4
- package/test/snapshots/svelte/07-stores/00-writable-stores/App.snap.ast +4 -5
- package/test/snapshots/svelte/07-stores/00-writable-stores/Decrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/00-writable-stores/Incrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/00-writable-stores/Resetter.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/App.snap.ast +4 -5
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Decrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Incrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Resetter.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/02-readable-stores/App.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/03-derived-stores/App.snap.ast +8 -10
- package/test/snapshots/svelte/07-stores/04-custom-stores/App.snap.ast +7 -11
- package/test/snapshots/svelte/08-motion/00-tweened/App.snap.ast +10 -15
- package/test/snapshots/svelte/08-motion/01-spring/App.snap.ast +10 -10
- package/test/snapshots/svelte/09-transitions/00-transition/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/01-adding-parameters-to-transitions/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/02-in-and-out/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/03-custom-css-transitions/App.snap.ast +4 -6
- package/test/snapshots/svelte/09-transitions/04-custom-js-transitions/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/05-transition-events/App.snap.ast +5 -8
- package/test/snapshots/svelte/10-animations/00-animate/App.snap.ast +16 -20
- package/test/snapshots/svelte/11-easing/00-easing/App.snap.ast +16 -11
- package/test/snapshots/svelte/11-easing/00-easing/Controls.snap.ast +11 -16
- package/test/snapshots/svelte/11-easing/00-easing/Grid.snap.ast +2 -2
- package/test/snapshots/svelte/12-svg/01-clock/App.snap.ast +2 -1
- package/test/snapshots/svelte/12-svg/02-bar-chart/App.snap.ast +7 -9
- package/test/snapshots/svelte/12-svg/03-area-chart/App.snap.ast +14 -15
- package/test/snapshots/svelte/12-svg/04-scatterplot/App.snap.ast +7 -5
- package/test/snapshots/svelte/12-svg/04-scatterplot/Scatterplot.snap.ast +6 -6
- package/test/snapshots/svelte/12-svg/05-svg-transitions/App.snap.ast +5 -6
- package/test/snapshots/svelte/13-actions/01-adding-parameters-to-actions/App.snap.ast +2 -3
- package/test/snapshots/svelte/14-classes/00-classes/App.snap.ast +3 -6
- package/test/snapshots/svelte/14-classes/01-class-shorthand/App.snap.ast +2 -3
- package/test/snapshots/svelte/15-composition/00-slots/App.snap.ast +3 -5
- package/test/snapshots/svelte/15-composition/01-slot-fallbacks/App.snap.ast +3 -5
- package/test/snapshots/svelte/15-composition/01-slot-fallbacks/Box.snap.ast +1 -2
- package/test/snapshots/svelte/15-composition/02-named-slots/App.snap.ast +7 -11
- package/test/snapshots/svelte/15-composition/02-named-slots/ContactCard.snap.ast +3 -6
- package/test/snapshots/svelte/15-composition/03-slot-props/App.snap.ast +9 -15
- package/test/snapshots/svelte/15-composition/04-modal/App.snap.ast +17 -26
- package/test/snapshots/svelte/15-composition/04-modal/Modal.snap.ast +3 -3
- package/test/snapshots/svelte/16-context/00-context-api/App.snap.ast +10 -5
- package/test/snapshots/svelte/17-special-elements/00-svelte-self/File.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/00-svelte-self/Folder.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/App.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/BlueThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/GreenThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/RedThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/02-svelte-window/App.snap.ast +3 -6
- package/test/snapshots/svelte/17-special-elements/03-svelte-window-bindings/App.snap.ast +2 -4
- package/test/snapshots/svelte/17-special-elements/05-svelte-head/App.snap.ast +6 -12
- package/test/snapshots/svelte/18-module-context/01-module-exports/App.snap.ast +2 -3
- package/test/snapshots/svelte/18-module-context/01-module-exports/AudioPlayer.snap.ast +4 -7
- package/test/snapshots/svelte/19-debugging/00-debug/App.snap.ast +5 -7
- package/test/snapshots/svelte/19-debugging/00-debug/Test.snap.ast +7 -11
- package/test/snapshots/svelte/20-7guis/01-7guis-counter/App.snap.ast +2 -3
- package/test/snapshots/svelte/20-7guis/02-7guis-temperature/App.snap.ast +2 -2
- package/test/snapshots/svelte/20-7guis/03-7guis-flight-booker/App.snap.ast +4 -7
- package/test/snapshots/svelte/20-7guis/04-7guis-timer/App.snap.ast +13 -17
- package/test/snapshots/svelte/20-7guis/05-7guis-crud/App.snap.ast +11 -13
- package/test/snapshots/svelte/20-7guis/06-7guis-circles/App.snap.ast +10 -11
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Comment.snap.ast +4 -6
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Item.snap.ast +9 -13
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/List.snap.ast +3 -5
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Summary.snap.ast +7 -11
- package/test/snapshots/svelte/21-miscellaneous/02-immutable-data/App.snap.ast +2 -4
- package/test/snapshots/svelte/99-embeds/20181225-blog-svelte-css-in-js/App.snap.ast +6 -7
- package/test/snapshots/svelte/99-embeds/20181225-blog-svelte-css-in-js/Hero.snap.ast +3 -5
- package/test/snapshots/svelte/99-embeds/20190420-blog-write-less-code/App.snap.ast +6 -7
- package/test/svelte_expressions.spec.ts +93 -4
- package/test/svelte_tags.spec.ts +27 -12
- package/test/tables.spec.ts +347 -0
- package/test/tree_builder.spec.ts +286 -1
- package/test/unclosed_delimiters.spec.ts +529 -0
- package/tsc/buf_utils.d.ts +1 -1
- package/tsc/buf_utils.js +9 -9
- package/tsc/cursor.d.ts +17 -13
- package/tsc/cursor.js +60 -43
- package/tsc/main.d.ts +362 -26
- package/tsc/main.js +8955 -4891
- package/tsc/node_view.d.ts +11 -12
- package/tsc/node_view.js +134 -102
- package/tsc/opcodes.d.ts +23 -6
- package/tsc/plugin_dispatch.d.ts +22 -8
- package/tsc/plugin_dispatch.js +292 -170
- package/tsc/tree_builder.d.ts +42 -11
- package/tsc/tree_builder.js +237 -82
- package/tsc/undo_log.d.ts +11 -1
- package/tsc/undo_log.js +54 -19
- package/tsc/utils.d.ts +77 -51
- package/tsc/utils.js +687 -344
- package/tsc/utils.spec.js +83 -9
- package/tsc/wire_emitter.js +6 -0
- package/tsc/wire_tree_builder.d.ts +4 -7
- package/tsc/wire_tree_builder.js +34 -37
- package/dist/node_view-BEh2-H86.js +0 -373
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,218 @@
|
|
|
1
1
|
# parse
|
|
2
2
|
|
|
3
|
+
## 1.0.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#879](https://github.com/pngwn/MDsveX/pull/879) [`79bebc9`](https://github.com/pngwn/MDsveX/commit/79bebc937b5c51d7fb50d06ff09f83bf23d44a87) Thanks [@pngwn](https://github.com/pngwn)! - Leaf and container directive labels now take inline markdown, as inline directive text does. A directive component's `label` snippet renders it, so `:::Callout[Heads *up*]` passes `Heads <strong>up</strong>`. Links, images and autolinks stay literal, and nothing in a label reaches past its closing `]`, so `::x[*a](k=*)` keeps `*a` as text and its args intact.
|
|
8
|
+
|
|
9
|
+
In the parse tree the label is a `directive_label` node, the directive's first child, so a container's label stays apart from its body:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
directive_container name="Callout"
|
|
13
|
+
directive_label
|
|
14
|
+
text "Heads "
|
|
15
|
+
strong_emphasis
|
|
16
|
+
text "up"
|
|
17
|
+
paragraph
|
|
18
|
+
text "body"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- [#899](https://github.com/pngwn/MDsveX/pull/899) [`1219ceb`](https://github.com/pngwn/MDsveX/commit/1219ceb0c6805ac8b169dadb13694f354d96a619) Thanks [@pngwn](https://github.com/pngwn)! - Tables can have header columns and merged cells. A `||` in the delimiter row, matched by an empty `||` cell in the header row, turns the columns on its narrower side into row headers, and two `||` give headers on both sides. A cell holding only `>` merges into the cell to its left, and a cell holding only `^` merges into the cell above. Merged cells must form rectangles, and a marker that can't merge stays text.
|
|
22
|
+
|
|
23
|
+
```md
|
|
24
|
+
| maybe || title |> |
|
|
25
|
+
|-------||-------|---|
|
|
26
|
+
| hello || text | b |
|
|
27
|
+
|^ || more | c |
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- [#821](https://github.com/pngwn/MDsveX/pull/821) [`ed11417`](https://github.com/pngwn/MDsveX/commit/ed11417775290f85a0b14dda03d1c11d48bbd239) Thanks [@pngwn](https://github.com/pngwn)! - Export `normalize_newlines` and `raw_offsets`, so tools that read parser positions can map them back to a source with `\r\n` line endings.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
const offsets = raw_offsets(source); // null when there is nothing to map
|
|
34
|
+
const start = offsets ? offsets.to_raw(node_start) : node_start;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- [#866](https://github.com/pngwn/MDsveX/pull/866) [`60da683`](https://github.com/pngwn/MDsveX/commit/60da68313df11747bdd6235dffc325c30af60cb2) Thanks [@pngwn](https://github.com/pngwn)! - Paragraphs around HTML, components and Svelte tags follow one rule:
|
|
38
|
+
- A paragraph of only tags, components, `{@...}` tags and whitespace gets no `<p>`, and keeps its spaces and line breaks.
|
|
39
|
+
- Any text outside the tags wraps the whole paragraph in a `<p>`, so `<X /> hello` renders `<p><X /> hello</p>` instead of splitting it.
|
|
40
|
+
- A paragraph holding a block level element such as `<div>` or `<p>` is never wrapped.
|
|
41
|
+
|
|
42
|
+
An element that opens and closes on the same line holds inline content, so `<div><p>hi</p></div>` no longer gets an extra `<p>` inside it. One that stays open past its line holds blocks as before, and an element like `<p>`, `<span>` or `<button>` never wraps its content in `<p>`.
|
|
43
|
+
|
|
44
|
+
A `{#if}` style block opener at the start of a line now ends the paragraph before it.
|
|
45
|
+
|
|
46
|
+
```md
|
|
47
|
+
<Chart />
|
|
48
|
+
<Legend />
|
|
49
|
+
|
|
50
|
+
<Badge>new</Badge> in this release
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- [#864](https://github.com/pngwn/MDsveX/pull/864) [`cfee8d1`](https://github.com/pngwn/MDsveX/commit/cfee8d1a968ac78329e314650c51785968bf1dff) Thanks [@pngwn](https://github.com/pngwn)! - A backtick followed by a space at the very end of the input stays literal text instead of becoming an unclosed code span.
|
|
56
|
+
|
|
57
|
+
- [#893](https://github.com/pngwn/MDsveX/pull/893) [`b249bf0`](https://github.com/pngwn/MDsveX/commit/b249bf0dbbfdef330e0e78739b7d44176f9c98b9) Thanks [@pngwn](https://github.com/pngwn)! - A code span holding only `#!` or `#!lang`, with no space and code after it, renders as ordinary inline code showing that text, and never takes a language hint.
|
|
58
|
+
|
|
59
|
+
```md
|
|
60
|
+
Write `#!ts` or `#!` in prose.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- [#866](https://github.com/pngwn/MDsveX/pull/866) [`29b6dd1`](https://github.com/pngwn/MDsveX/commit/29b6dd127efc0d00dff650d320d4d003f6d2b1b6) Thanks [@pngwn](https://github.com/pngwn)! - A closing tag of an enclosing HTML element or component on its own line now ends the paragraph or list item before it, so the line break and indentation before the tag no longer end up inside the paragraph.
|
|
64
|
+
|
|
65
|
+
```md
|
|
66
|
+
<Card>
|
|
67
|
+
- one
|
|
68
|
+
- two
|
|
69
|
+
</Card>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- [#880](https://github.com/pngwn/MDsveX/pull/880) [`7815ee9`](https://github.com/pngwn/MDsveX/commit/7815ee9d0993774f6f648d46d35ce3f900a6eed4) Thanks [@pngwn](https://github.com/pngwn)! - A container directive inside a block quote parses its quoted body lines as normal content, and `> :::` closes it.
|
|
73
|
+
|
|
74
|
+
- [#878](https://github.com/pngwn/MDsveX/pull/878) [`db0418d`](https://github.com/pngwn/MDsveX/commit/db0418d50bcd286a062cd0b6243a234167d11781) Thanks [@pngwn](https://github.com/pngwn)! - Bullet and ordered lists inside a container directive (`:::name[]`) parse as lists instead of paragraphs.
|
|
75
|
+
|
|
76
|
+
- [#903](https://github.com/pngwn/MDsveX/pull/903) [`ebdb9fb`](https://github.com/pngwn/MDsveX/commit/ebdb9fb687933c69da0260eb50e8a4d2fae2bbca) Thanks [@pngwn](https://github.com/pngwn)! - Emphasis, strong, strikethrough, superscript and subscript close right after a Svelte expression, tag or code span, so `*{name}*` and ``_`code`_`` are no longer left as literal delimiters.
|
|
77
|
+
|
|
78
|
+
- [#855](https://github.com/pngwn/MDsveX/pull/855) [`98a1b87`](https://github.com/pngwn/MDsveX/commit/98a1b87b1c45f192c93bf3b910d6ebc8284b94f4) Thanks [@pngwn](https://github.com/pngwn)! - Parsing markdown is much faster, up to about 3x, and incremental (streaming) parsing is faster as well. Parsing many documents in a row reuses one parser instead of creating a new one for each document.
|
|
79
|
+
|
|
80
|
+
- [#862](https://github.com/pngwn/MDsveX/pull/862) [`31aa6e2`](https://github.com/pngwn/MDsveX/commit/31aa6e20390c6fa656845add1d19e0439dda48c7) Thanks [@pngwn](https://github.com/pngwn)! - Parsing, compiling, parse plugins and the vite plugin are faster for documents of every size. The largest gains are in compiles with parse plugins and in the vite plugin, where chaining the Svelte compiler's sourcemap no longer goes through a general purpose remapper.
|
|
81
|
+
|
|
82
|
+
- [#865](https://github.com/pngwn/MDsveX/pull/865) [`fd54579`](https://github.com/pngwn/MDsveX/commit/fd5457966ce23d1eb29a7935a550394adf4498e4) Thanks [@pngwn](https://github.com/pngwn)! - Parsing, incremental parsing, compiling with and without sourcemaps, parse plugins and the vite plugin are faster again for documents of every size, with the largest gains on small documents, sourcemapped compiles and Windows line endings.
|
|
83
|
+
|
|
84
|
+
- [#885](https://github.com/pngwn/MDsveX/pull/885) [`e804671`](https://github.com/pngwn/MDsveX/commit/e804671afb412c81ce5cb38c40588257d34ab99d) Thanks [@pngwn](https://github.com/pngwn)! - A fenced code block that ends at the end of the input no longer overwrites the label value of the container directive around it.
|
|
85
|
+
|
|
86
|
+
- [#885](https://github.com/pngwn/MDsveX/pull/885) [`e804671`](https://github.com/pngwn/MDsveX/commit/e804671afb412c81ce5cb38c40588257d34ab99d) Thanks [@pngwn](https://github.com/pngwn)! - A fenced code block whose opening line is the last line of the input is an empty code block with that info string, instead of taking the whole document as its value.
|
|
87
|
+
|
|
88
|
+
- [#859](https://github.com/pngwn/MDsveX/pull/859) [`2f981d8`](https://github.com/pngwn/MDsveX/commit/2f981d84b04a718dae82f79e6a9243868444f88c) Thanks [@pngwn](https://github.com/pngwn)! - Content after an unclosed `*`, `_`, `~`, `^`, `[` or HTML tag in a heading is no longer dropped. The heading ends at the line end and the next line is parsed as usual. The same holds for an unclosed `[` before a heading, list item, block quote, fence or rule, and a link can now continue across block quote lines.
|
|
89
|
+
|
|
90
|
+
- [#864](https://github.com/pngwn/MDsveX/pull/864) [`cfee8d1`](https://github.com/pngwn/MDsveX/commit/cfee8d1a968ac78329e314650c51785968bf1dff) Thanks [@pngwn](https://github.com/pngwn)! - Trailing whitespace after an inline element at the end of a heading no longer leaves an empty text node in the heading.
|
|
91
|
+
|
|
92
|
+
```md
|
|
93
|
+
# <b>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- [#854](https://github.com/pngwn/MDsveX/pull/854) [`6f4a27d`](https://github.com/pngwn/MDsveX/commit/6f4a27da11241056ef4912618cefee521525a82a) Thanks [@pngwn](https://github.com/pngwn)! - Content after an HTML block that contained a list, blockquote, table or Svelte block is no longer dropped when the closing tag sits on the same line as that content.
|
|
97
|
+
|
|
98
|
+
- [#861](https://github.com/pngwn/MDsveX/pull/861) [`585a698`](https://github.com/pngwn/MDsveX/commit/585a698f25fd0b6160e25bf0022e3cdabde65172) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing waits for the character after `^` or `~~` before deciding whether it opens superscript or strikethrough, so a `^` or `~~` at the end of a line stays text, the same as in a full parse.
|
|
99
|
+
|
|
100
|
+
- [#847](https://github.com/pngwn/MDsveX/pull/847) [`65c9784`](https://github.com/pngwn/MDsveX/commit/65c9784b51209c7706eebaada3e9908bda9d5fa4) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing now ends an unclosed code span at a blank line, like a full parse does, even when a chunk ends right after the line break before it.
|
|
101
|
+
|
|
102
|
+
- [#862](https://github.com/pngwn/MDsveX/pull/862) [`31aa6e2`](https://github.com/pngwn/MDsveX/commit/31aa6e20390c6fa656845add1d19e0439dda48c7) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing gives the same result as parsing the whole document when a chunk ends right after a `+` or `1.` list marker with no content yet, or inside an open tag whose attributes contain a `>`.
|
|
103
|
+
|
|
104
|
+
```md
|
|
105
|
+
- x
|
|
106
|
+
<C b={x > 1}>y</C>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- [#861](https://github.com/pngwn/MDsveX/pull/861) [`585a698`](https://github.com/pngwn/MDsveX/commit/585a698f25fd0b6160e25bf0022e3cdabde65172) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing waits for the character after a whole run of `#` before deciding whether a line starts a heading, so a line like `##text` that ends a chunk still continues the paragraph above, the same as in a full parse.
|
|
110
|
+
|
|
111
|
+
- [#861](https://github.com/pngwn/MDsveX/pull/861) [`585a698`](https://github.com/pngwn/MDsveX/commit/585a698f25fd0b6160e25bf0022e3cdabde65172) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing waits for enough of the next line before deciding whether a line break ends unclosed link text, directive text or an inline HTML element, so text like `*:x[` followed by `#]` on the next line gives the same tree as a full parse.
|
|
112
|
+
|
|
113
|
+
- [#855](https://github.com/pngwn/MDsveX/pull/855) [`98a1b87`](https://github.com/pngwn/MDsveX/commit/98a1b87b1c45f192c93bf3b910d6ebc8284b94f4) Thanks [@pngwn](https://github.com/pngwn)! - A document that ends in a lone carriage return (`\r`) now parses the same way incrementally as it does in a single pass.
|
|
114
|
+
|
|
115
|
+
- [#865](https://github.com/pngwn/MDsveX/pull/865) [`fd54579`](https://github.com/pngwn/MDsveX/commit/fd5457966ce23d1eb29a7935a550394adf4498e4) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing recognises a fenced code block inside a block quote when a chunk boundary splits the quote markers, matching a full parse.
|
|
116
|
+
|
|
117
|
+
- [#861](https://github.com/pngwn/MDsveX/pull/861) [`585a698`](https://github.com/pngwn/MDsveX/commit/585a698f25fd0b6160e25bf0022e3cdabde65172) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing recognises a `---`, `***` or `___` line inside an HTML block, a Svelte block or a directive container as a thematic break when it is the last line fed so far, instead of turning it into a paragraph.
|
|
118
|
+
|
|
119
|
+
```md
|
|
120
|
+
## <div>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
- [#861](https://github.com/pngwn/MDsveX/pull/861) [`585a698`](https://github.com/pngwn/MDsveX/commit/585a698f25fd0b6160e25bf0022e3cdabde65172) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing waits for the character after a closing `~` or `~~` before closing subscript or strikethrough, so text like `~a~~` or `~~~~a` gives the same tree as a full parse.
|
|
124
|
+
|
|
125
|
+
- [#866](https://github.com/pngwn/MDsveX/pull/866) [`29b6dd1`](https://github.com/pngwn/MDsveX/commit/29b6dd127efc0d00dff650d320d4d003f6d2b1b6) Thanks [@pngwn](https://github.com/pngwn)! - List items indented by the same amount are siblings again. The first item's indent was measured after its leading whitespace had been skipped, so later items nested under it. This affected any indented list, including lists inside HTML elements and components.
|
|
126
|
+
|
|
127
|
+
```md
|
|
128
|
+
<div>
|
|
129
|
+
|
|
130
|
+
- one
|
|
131
|
+
- two
|
|
132
|
+
|
|
133
|
+
</div>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
- [#862](https://github.com/pngwn/MDsveX/pull/862) [`31aa6e2`](https://github.com/pngwn/MDsveX/commit/31aa6e20390c6fa656845add1d19e0439dda48c7) Thanks [@pngwn](https://github.com/pngwn)! - Documents keep everything after a paragraph with more than a hundred or so unmatched `*`, `_`, `[`, `~~` or inline HTML tags, and after an unclosed `[` inside a table, instead of ending early.
|
|
137
|
+
|
|
138
|
+
```md
|
|
139
|
+
## ||
|
|
140
|
+
|
|
141
|
+
[
|
|
142
|
+
d
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
- [#852](https://github.com/pngwn/MDsveX/pull/852) [`9903c3a`](https://github.com/pngwn/MDsveX/commit/9903c3ad8d764085285486816736c4f3ea140a99) Thanks [@pngwn](https://github.com/pngwn)! - Streaming a document with `feed()` stays fast when a single list, block quote or code fence is very large. An 8000 line list or code fence fed in 64 character chunks now parses in about 50ms instead of 3 to 6 seconds.
|
|
146
|
+
|
|
147
|
+
- [#851](https://github.com/pngwn/MDsveX/pull/851) [`7e69d52`](https://github.com/pngwn/MDsveX/commit/7e69d52284e20892752041fb42726480d88cf31c) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing with `feed()` now takes time proportional to the input size, so streaming small chunks into a large document is no longer slower than parsing it in one go. A 3.8MB document fed in 64 character chunks parses in about 0.35s instead of 27s.
|
|
148
|
+
|
|
149
|
+
- [#865](https://github.com/pngwn/MDsveX/pull/865) [`fd54579`](https://github.com/pngwn/MDsveX/commit/fd5457966ce23d1eb29a7935a550394adf4498e4) Thanks [@pngwn](https://github.com/pngwn)! - Incremental parsing stays linear for fenced code inside block quotes, long lines and list items inside block quotes, paragraphs with many brackets that are not links, and long tight lists of task boxes, links or inline html.
|
|
150
|
+
|
|
151
|
+
- [#862](https://github.com/pngwn/MDsveX/pull/862) [`31aa6e2`](https://github.com/pngwn/MDsveX/commit/31aa6e20390c6fa656845add1d19e0439dda48c7) Thanks [@pngwn](https://github.com/pngwn)! - Parsing time stays proportional to document size when a document has unmatched braces or stray `<word` text. Incremental parsing also stays linear inside long paragraphs, tables, pending emphasis and unclosed braces, frontmatter, comments, code spans or HTML and Svelte blocks, where it used to slow down with every chunk.
|
|
152
|
+
|
|
153
|
+
- [#885](https://github.com/pngwn/MDsveX/pull/885) [`e804671`](https://github.com/pngwn/MDsveX/commit/e804671afb412c81ce5cb38c40588257d34ab99d) Thanks [@pngwn](https://github.com/pngwn)! - Lines in a nested block quote stay at their own depth after a heading, thematic break, code fence or blank quoted line. A line with fewer `>` markers closes the deeper quotes instead of opening another one.
|
|
154
|
+
|
|
155
|
+
```md
|
|
156
|
+
> > # heading
|
|
157
|
+
> >
|
|
158
|
+
> > stays in the inner quote
|
|
159
|
+
> > back in the outer quote
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
- [#855](https://github.com/pngwn/MDsveX/pull/855) [`98a1b87`](https://github.com/pngwn/MDsveX/commit/98a1b87b1c45f192c93bf3b910d6ebc8284b94f4) Thanks [@pngwn](https://github.com/pngwn)! - `NodeBuffer` now stores all of a node's fields together in one typed array, so its raw per-field arrays such as `_kinds` and `_starts` no longer exist; read nodes through its accessor methods instead. Node ids passed to a custom emitter are now node buffer indices, so text nodes take an id too and the ids seen by `open` can skip numbers.
|
|
163
|
+
|
|
164
|
+
- [#853](https://github.com/pngwn/MDsveX/pull/853) [`f2e4911`](https://github.com/pngwn/MDsveX/commit/f2e4911db89f7c66f684c0da839deeb3bc46fa55) Thanks [@pngwn](https://github.com/pngwn)! - Compiling several documents with one compiler session, as the vite plugin does, no longer lets a document that ends in an unfinished heading such as `` # ` `` make later documents lose the text after their first line.
|
|
165
|
+
|
|
166
|
+
- [#885](https://github.com/pngwn/MDsveX/pull/885) [`e804671`](https://github.com/pngwn/MDsveX/commit/e804671afb412c81ce5cb38c40588257d34ab99d) Thanks [@pngwn](https://github.com/pngwn)! - A fenced code block inside a block quote closes on a quoted closing line (` > ``` `) instead of running to the end of the document. Its value is the raw source of the content lines, so every line keeps its `>` markers.
|
|
167
|
+
|
|
168
|
+
- [#859](https://github.com/pngwn/MDsveX/pull/859) [`2f981d8`](https://github.com/pngwn/MDsveX/commit/2f981d84b04a718dae82f79e6a9243868444f88c) Thanks [@pngwn](https://github.com/pngwn)! - Content after a block quote is no longer dropped when the quote's last line ends with an unclosed HTML tag and the next line has no `>`.
|
|
169
|
+
|
|
170
|
+
- [#885](https://github.com/pngwn/MDsveX/pull/885) [`e804671`](https://github.com/pngwn/MDsveX/commit/e804671afb412c81ce5cb38c40588257d34ab99d) Thanks [@pngwn](https://github.com/pngwn)! - An extra `>` marker inside a block quote paragraph starts a nested quote, matching how `>` interrupts a paragraph outside a quote.
|
|
171
|
+
|
|
172
|
+
- [#865](https://github.com/pngwn/MDsveX/pull/865) [`fd54579`](https://github.com/pngwn/MDsveX/commit/fd5457966ce23d1eb29a7935a550394adf4498e4) Thanks [@pngwn](https://github.com/pngwn)! - Sequential parse plugins visit every node added by an earlier handler, however large the document.
|
|
173
|
+
|
|
174
|
+
- [#866](https://github.com/pngwn/MDsveX/pull/866) [`60da683`](https://github.com/pngwn/MDsveX/commit/60da68313df11747bdd6235dffc325c30af60cb2) Thanks [@pngwn](https://github.com/pngwn)! - `<svelte:head>`, `<svelte:window>` and other `svelte:` elements are parsed as elements instead of URI autolinks.
|
|
175
|
+
|
|
176
|
+
- [#901](https://github.com/pngwn/MDsveX/pull/901) [`430cf34`](https://github.com/pngwn/MDsveX/commit/430cf3493575c706b31b5e02b4c219f4b6ea0569) Thanks [@pngwn](https://github.com/pngwn)! - An unclosed backtick followed by a space no longer runs past the cell's closing pipe or the end of the row, and in a paragraph it no longer spans a blank line.
|
|
177
|
+
|
|
178
|
+
- [#897](https://github.com/pngwn/MDsveX/pull/897) [`eefaff5`](https://github.com/pngwn/MDsveX/commit/eefaff563e6ce05026f92c03fce21b3ba4bd5e77) Thanks [@pngwn](https://github.com/pngwn)! - An unclosed delimiter in a table cell, such as `^2`, `~2`, `*2`, `[2` or a lone code span backtick, stays literal text without picking up the cell's trailing whitespace.
|
|
179
|
+
|
|
180
|
+
- [#898](https://github.com/pngwn/MDsveX/pull/898) [`3f5bbbb`](https://github.com/pngwn/MDsveX/commit/3f5bbbb069ca12e16b3bb96afb60c41362161109) Thanks [@pngwn](https://github.com/pngwn)! - A table row with more cells than the header drops the extra cells instead of leaving their content as text directly inside the table.
|
|
181
|
+
|
|
182
|
+
- [#847](https://github.com/pngwn/MDsveX/pull/847) [`65c9784`](https://github.com/pngwn/MDsveX/commit/65c9784b51209c7706eebaada3e9908bda9d5fa4) Thanks [@pngwn](https://github.com/pngwn)! - An unclosed `*`, `_`, `~~`, `~` or `^` followed by a line that starts a list item, blockquote, fence or HTML block stays literal text, and the rest of the document parses in full.
|
|
183
|
+
|
|
184
|
+
```md
|
|
185
|
+
1. ~1
|
|
186
|
+
2. -
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
- [#861](https://github.com/pngwn/MDsveX/pull/861) [`585a698`](https://github.com/pngwn/MDsveX/commit/585a698f25fd0b6160e25bf0022e3cdabde65172) Thanks [@pngwn](https://github.com/pngwn)! - An unclosed delimiter keeps exactly its own characters as text. A `[` or ` [`585a698`](https://github.com/pngwn/MDsveX/commit/585a698f25fd0b6160e25bf0022e3cdabde65172) Thanks [@pngwn](https://github.com/pngwn)! - An unclosed inline directive keeps its whole opener as text. Before, a line like `:name[` that was never closed kept only the `:`.
|
|
197
|
+
|
|
198
|
+
```md
|
|
199
|
+
:name[
|
|
200
|
+
|
|
201
|
+
# heading
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- [#852](https://github.com/pngwn/MDsveX/pull/852) [`9903c3a`](https://github.com/pngwn/MDsveX/commit/9903c3ad8d764085285486816736c4f3ea140a99) Thanks [@pngwn](https://github.com/pngwn)! - Inline HTML that is never closed and falls back to plain text now keeps its full original text, instead of a truncated or unrelated fragment.
|
|
205
|
+
|
|
206
|
+
- [#859](https://github.com/pngwn/MDsveX/pull/859) [`2f981d8`](https://github.com/pngwn/MDsveX/commit/2f981d84b04a718dae82f79e6a9243868444f88c) Thanks [@pngwn](https://github.com/pngwn)! - An unclosed HTML tag now shows its text once. Content after it on the same line is no longer repeated, and a tag that spans lines keeps all of its text.
|
|
207
|
+
|
|
208
|
+
```md
|
|
209
|
+
a <b>x
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
renders as `<p>a <b>x</p>` rather than `<p>a <b>xx</p>`.
|
|
213
|
+
|
|
214
|
+
- [#849](https://github.com/pngwn/MDsveX/pull/849) [`cbc0029`](https://github.com/pngwn/MDsveX/commit/cbc00291119021655765fd4f4e05d9f4fb320727) Thanks [@pngwn](https://github.com/pngwn)! - Backticks with no closing run stay as literal text, including every backtick in a run of two or more, and a blank line after them still ends the paragraph.
|
|
215
|
+
|
|
3
216
|
## 1.0.0-next.0
|
|
4
217
|
|
|
5
218
|
### Major Changes
|
package/WIRE_FORMAT.md
CHANGED
|
@@ -246,7 +246,11 @@ Table {
|
|
|
246
246
|
}
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-
Each `table_cell` contains inline content (text, emphasis, etc.).
|
|
249
|
+
Each `table_cell` contains inline content (text, emphasis, etc.). A cell's `extra` is the grid column it starts in.
|
|
250
|
+
|
|
251
|
+
Optional table attrs: `header_columns: [left, right]` counts the header columns at the start and end of every row, from a `||` in the delimiter row. `spans: true` says some cell in the table has a `colspan` or `rowspan` attr. Both are only present when they apply.
|
|
252
|
+
|
|
253
|
+
A merged cell carries `colspan` and/or `rowspan` attrs, which can arrive after the cell closed: a `>` or `^` marker cell is revoked once it's known to merge, and its owner gets the new span. A row whose every column merged up has no cells.
|
|
250
254
|
|
|
251
255
|
## Example: Processing a Batch
|
|
252
256
|
|
package/dist/buf-utils.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
let e = t.
|
|
1
|
+
function f(t, n) {
|
|
2
|
+
const s = [];
|
|
3
|
+
let e = t.first_child_at(n);
|
|
4
4
|
for (; e !== 4294967295; ) {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
5
|
+
s.push(e);
|
|
6
|
+
const r = t.next_at(e);
|
|
7
|
+
if (r === 4294967295 || t.parent_at(r) !== n)
|
|
8
8
|
break;
|
|
9
|
-
e =
|
|
9
|
+
e = r;
|
|
10
10
|
}
|
|
11
|
-
return
|
|
11
|
+
return s;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function a(t, n, s) {
|
|
14
14
|
const e = t._strings[n];
|
|
15
15
|
if (e !== void 0)
|
|
16
16
|
return e;
|
|
17
|
-
const
|
|
18
|
-
return
|
|
17
|
+
const r = t.value_start_at(n), c = t.value_end_at(n);
|
|
18
|
+
return r === 4294967295 || c === 4294967295 || c <= r ? "" : s.slice(r, c);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const e =
|
|
20
|
+
function i(t, n, s) {
|
|
21
|
+
const e = a(t, n, s);
|
|
22
22
|
if (e)
|
|
23
23
|
return e;
|
|
24
|
-
let
|
|
25
|
-
for (;
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
24
|
+
let r = "", c = t.first_child_at(n);
|
|
25
|
+
for (; c !== 4294967295; ) {
|
|
26
|
+
r += i(t, c, s);
|
|
27
|
+
const _ = t.next_at(c);
|
|
28
|
+
if (_ === 4294967295 || t.parent_at(_) !== n)
|
|
29
29
|
break;
|
|
30
|
-
|
|
30
|
+
c = _;
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return r;
|
|
33
33
|
}
|
|
34
34
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
f as buf_children,
|
|
36
|
+
a as buf_text,
|
|
37
|
+
i as buf_text_content
|
|
38
38
|
};
|
package/dist/buf_utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* buffer utilities for svelte components.
|
|
3
3
|
*
|
|
4
|
-
* pure functions that read from NodeBuffer
|
|
4
|
+
* pure functions that read from NodeBuffer accessors.
|
|
5
5
|
* no cursor state, no allocations beyond the returned arrays.
|
|
6
6
|
*/
|
|
7
7
|
import type { NodeBuffer } from './utils';
|
package/dist/cursor.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* single reusable object that provides tree-traversal semantics
|
|
5
5
|
* (gotofirstchild / gotonextsibling / gotoparent) while reading
|
|
6
|
-
* directly from the
|
|
6
|
+
* directly from the node words underneath. no per-node
|
|
7
7
|
* objects are created, text is lazily sliced from the source
|
|
8
8
|
* string only when requested.
|
|
9
9
|
*
|
|
@@ -22,24 +22,17 @@
|
|
|
22
22
|
* cursor.gotoparent();
|
|
23
23
|
* }
|
|
24
24
|
*/
|
|
25
|
-
import type
|
|
25
|
+
import { type NodeBuffer } from './utils';
|
|
26
26
|
export declare class Cursor {
|
|
27
|
-
/** the backing soa buffer. */
|
|
28
27
|
private buf;
|
|
29
28
|
/** the full source string for lazy text slicing. */
|
|
30
29
|
private src;
|
|
31
30
|
/** current node index into the buffer. */
|
|
32
31
|
private idx;
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
private _value_starts;
|
|
38
|
-
private _value_ends;
|
|
39
|
-
private _parents;
|
|
40
|
-
private _next_siblings;
|
|
41
|
-
private _children_starts;
|
|
42
|
-
private _pending_nodes;
|
|
32
|
+
/** idx times NodeField.stride */
|
|
33
|
+
private b;
|
|
34
|
+
/** cached buf._n */
|
|
35
|
+
private n;
|
|
43
36
|
constructor(buf: NodeBuffer, source: string);
|
|
44
37
|
/** numeric kind of current node. */
|
|
45
38
|
get kind(): number;
|
|
@@ -64,6 +57,9 @@ export declare class Cursor {
|
|
|
64
57
|
/** get text content for the current node. prebuilt strings
|
|
65
58
|
(from wiretreebuilder) are returned directly; otherwise sliced lazily. */
|
|
66
59
|
text(): string;
|
|
60
|
+
get source(): string;
|
|
61
|
+
/** undefined when text slices the source */
|
|
62
|
+
get prebuilt(): string | undefined;
|
|
67
63
|
/** get metadata for the current node, or undefined if none. */
|
|
68
64
|
meta(): Record<string, unknown> | undefined;
|
|
69
65
|
/** slice the source string by byte offsets. for resolving metadata offset pairs. */
|
|
@@ -71,9 +67,17 @@ export declare class Cursor {
|
|
|
71
67
|
goto_first_child(): boolean;
|
|
72
68
|
goto_next_sibling(): boolean;
|
|
73
69
|
goto_parent(): boolean;
|
|
70
|
+
/** @internal */
|
|
71
|
+
get words(): Uint32Array;
|
|
72
|
+
/** @internal undefined when text slices the source */
|
|
73
|
+
prebuilt_at(idx: number): string | undefined;
|
|
74
|
+
/** @internal no bounds checks */
|
|
75
|
+
move_to(idx: number): void;
|
|
74
76
|
reset(): void;
|
|
75
77
|
/** get child indices as an array (for svelte {#each} iteration). */
|
|
76
78
|
children(): number[];
|
|
79
|
+
/** a cursor kept for reuse must not pin the source */
|
|
80
|
+
release(): void;
|
|
77
81
|
/** re-inits cursor with a (potentially grown) buffer and new source. */
|
|
78
82
|
reinit(buf: NodeBuffer, source: string): void;
|
|
79
83
|
}
|
package/dist/cursor.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
class
|
|
1
|
+
class r {
|
|
2
2
|
constructor(t, s) {
|
|
3
|
-
this.buf = t, this.src = s, this.idx = 0, this.
|
|
3
|
+
this.buf = t, this.src = s, this.idx = 0, this.b = 0, this.n = t._n;
|
|
4
4
|
}
|
|
5
5
|
/** numeric kind of current node. */
|
|
6
6
|
get kind() {
|
|
7
|
-
return this.
|
|
7
|
+
return this.n[this.b] & 255;
|
|
8
8
|
}
|
|
9
9
|
/** kind-specific extra value (eg heading depth). */
|
|
10
10
|
get extra() {
|
|
11
|
-
return this.
|
|
11
|
+
return this.n[this.b] >>> 8;
|
|
12
12
|
}
|
|
13
13
|
/** current node index (for external id tracking / keyed lists). */
|
|
14
14
|
get index() {
|
|
@@ -16,32 +16,56 @@ class n {
|
|
|
16
16
|
}
|
|
17
17
|
/** if the current node is closed (end offset has been set). */
|
|
18
18
|
get closed() {
|
|
19
|
-
return this.
|
|
19
|
+
return this.n[
|
|
20
|
+
this.b + 2
|
|
21
|
+
/* NodeField.end */
|
|
22
|
+
] !== 4294967295;
|
|
20
23
|
}
|
|
21
24
|
/** if the current node is pending (speculative, may be revoked). */
|
|
22
25
|
get pending() {
|
|
23
|
-
return this.
|
|
26
|
+
return this.n[
|
|
27
|
+
this.b + 10
|
|
28
|
+
/* NodeField.pending */
|
|
29
|
+
] === 1;
|
|
24
30
|
}
|
|
25
31
|
/** parent kind of the current node, -1 if at root. */
|
|
26
32
|
get parent_kind() {
|
|
27
|
-
const t = this.
|
|
28
|
-
|
|
33
|
+
const t = this.n[
|
|
34
|
+
this.b + 5
|
|
35
|
+
/* NodeField.parent */
|
|
36
|
+
];
|
|
37
|
+
return t === 4294967295 ? -1 : this.n[
|
|
38
|
+
t * 12
|
|
39
|
+
/* NodeField.stride */
|
|
40
|
+
] & 255;
|
|
29
41
|
}
|
|
30
42
|
/** byte offset where the current node starts in source. */
|
|
31
43
|
get start() {
|
|
32
|
-
return this.
|
|
44
|
+
return this.n[
|
|
45
|
+
this.b + 1
|
|
46
|
+
/* NodeField.start */
|
|
47
|
+
];
|
|
33
48
|
}
|
|
34
49
|
/** byte offset where the current node ends in source. */
|
|
35
50
|
get end() {
|
|
36
|
-
return this.
|
|
51
|
+
return this.n[
|
|
52
|
+
this.b + 2
|
|
53
|
+
/* NodeField.end */
|
|
54
|
+
];
|
|
37
55
|
}
|
|
38
56
|
/** byte offset where the current node's value content starts. */
|
|
39
57
|
get value_start() {
|
|
40
|
-
return this.
|
|
58
|
+
return this.n[
|
|
59
|
+
this.b + 3
|
|
60
|
+
/* NodeField.value_start */
|
|
61
|
+
];
|
|
41
62
|
}
|
|
42
63
|
/** byte offset where the current node's value content ends. */
|
|
43
64
|
get value_end() {
|
|
44
|
-
return this.
|
|
65
|
+
return this.n[
|
|
66
|
+
this.b + 4
|
|
67
|
+
/* NodeField.value_end */
|
|
68
|
+
];
|
|
45
69
|
}
|
|
46
70
|
/** get text content for the current node. prebuilt strings
|
|
47
71
|
(from wiretreebuilder) are returned directly; otherwise sliced lazily. */
|
|
@@ -49,50 +73,113 @@ class n {
|
|
|
49
73
|
const t = this.buf._strings[this.idx];
|
|
50
74
|
if (t !== void 0)
|
|
51
75
|
return t;
|
|
52
|
-
const s = this.
|
|
76
|
+
const s = this.n[
|
|
77
|
+
this.b + 3
|
|
78
|
+
/* NodeField.value_start */
|
|
79
|
+
], i = this.n[
|
|
80
|
+
this.b + 4
|
|
81
|
+
/* NodeField.value_end */
|
|
82
|
+
];
|
|
53
83
|
return s === 4294967295 || i === 4294967295 || i <= s ? "" : this.src.slice(s, i);
|
|
54
84
|
}
|
|
85
|
+
get source() {
|
|
86
|
+
return this.src;
|
|
87
|
+
}
|
|
88
|
+
/** undefined when text slices the source */
|
|
89
|
+
get prebuilt() {
|
|
90
|
+
return this.buf._strings[this.idx];
|
|
91
|
+
}
|
|
55
92
|
/** get metadata for the current node, or undefined if none. */
|
|
56
93
|
meta() {
|
|
57
|
-
|
|
94
|
+
const t = this.n[
|
|
95
|
+
this.b + 11
|
|
96
|
+
/* NodeField.meta */
|
|
97
|
+
];
|
|
98
|
+
return t === 0 ? void 0 : this.buf._meta[t - 1];
|
|
58
99
|
}
|
|
59
100
|
/** slice the source string by byte offsets. for resolving metadata offset pairs. */
|
|
60
101
|
slice(t, s) {
|
|
61
102
|
return this.src.slice(t, s);
|
|
62
103
|
}
|
|
63
104
|
goto_first_child() {
|
|
64
|
-
const t = this.
|
|
65
|
-
|
|
105
|
+
const t = this.n[
|
|
106
|
+
this.b + 8
|
|
107
|
+
/* NodeField.first_child */
|
|
108
|
+
];
|
|
109
|
+
return t === 4294967295 ? !1 : (this.idx = t, this.b = t * 12, !0);
|
|
66
110
|
}
|
|
67
111
|
goto_next_sibling() {
|
|
68
|
-
const t = this.
|
|
69
|
-
|
|
112
|
+
const t = this.n, s = t[
|
|
113
|
+
this.b + 6
|
|
114
|
+
/* NodeField.next */
|
|
115
|
+
];
|
|
116
|
+
if (s === 4294967295)
|
|
117
|
+
return !1;
|
|
118
|
+
const i = s * 12;
|
|
119
|
+
return t[
|
|
120
|
+
i + 5
|
|
121
|
+
/* NodeField.parent */
|
|
122
|
+
] !== t[
|
|
123
|
+
this.b + 5
|
|
124
|
+
/* NodeField.parent */
|
|
125
|
+
] ? !1 : (this.idx = s, this.b = i, !0);
|
|
70
126
|
}
|
|
71
127
|
goto_parent() {
|
|
72
|
-
const t = this.
|
|
73
|
-
|
|
128
|
+
const t = this.n[
|
|
129
|
+
this.b + 5
|
|
130
|
+
/* NodeField.parent */
|
|
131
|
+
];
|
|
132
|
+
return t === 4294967295 ? !1 : (this.idx = t, this.b = t * 12, !0);
|
|
133
|
+
}
|
|
134
|
+
/** @internal */
|
|
135
|
+
get words() {
|
|
136
|
+
return this.n;
|
|
137
|
+
}
|
|
138
|
+
/** @internal undefined when text slices the source */
|
|
139
|
+
prebuilt_at(t) {
|
|
140
|
+
return this.buf._strings[t];
|
|
141
|
+
}
|
|
142
|
+
/** @internal no bounds checks */
|
|
143
|
+
move_to(t) {
|
|
144
|
+
this.idx = t, this.b = t * 12;
|
|
74
145
|
}
|
|
75
146
|
reset() {
|
|
76
|
-
this.idx = 0;
|
|
147
|
+
this.idx = 0, this.b = 0;
|
|
77
148
|
}
|
|
78
149
|
/** get child indices as an array (for svelte {#each} iteration). */
|
|
79
150
|
children() {
|
|
80
|
-
const t = [];
|
|
81
|
-
let
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
151
|
+
const t = this.n, s = [];
|
|
152
|
+
let i = t[
|
|
153
|
+
this.b + 8
|
|
154
|
+
/* NodeField.first_child */
|
|
155
|
+
];
|
|
156
|
+
for (; i !== 4294967295; ) {
|
|
157
|
+
s.push(i);
|
|
158
|
+
const n = t[
|
|
159
|
+
i * 12 + 6
|
|
160
|
+
/* NodeField.next */
|
|
161
|
+
];
|
|
162
|
+
if (n === 4294967295 || t[
|
|
163
|
+
n * 12 + 5
|
|
164
|
+
/* NodeField.parent */
|
|
165
|
+
] !== t[
|
|
166
|
+
i * 12 + 5
|
|
167
|
+
/* NodeField.parent */
|
|
168
|
+
])
|
|
86
169
|
break;
|
|
87
|
-
|
|
170
|
+
i = n;
|
|
88
171
|
}
|
|
89
|
-
return
|
|
172
|
+
return s;
|
|
173
|
+
}
|
|
174
|
+
/** a cursor kept for reuse must not pin the source */
|
|
175
|
+
release() {
|
|
176
|
+
this.src = "";
|
|
90
177
|
}
|
|
91
178
|
/** re-inits cursor with a (potentially grown) buffer and new source. */
|
|
92
179
|
reinit(t, s) {
|
|
93
|
-
this.buf = t, this.src = s, this.idx = 0, this.
|
|
180
|
+
this.buf = t, this.src = s, this.idx = 0, this.b = 0, this.n = t._n;
|
|
94
181
|
}
|
|
95
182
|
}
|
|
96
183
|
export {
|
|
97
|
-
|
|
184
|
+
r as Cursor
|
|
98
185
|
};
|