@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
|
@@ -17,17 +17,16 @@ root
|
|
|
17
17
|
svelte_branch tag="each" "filteredPeople as person, i"
|
|
18
18
|
line_break
|
|
19
19
|
html tag="option" value=[object Object]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
mustache "person.first"
|
|
20
|
+
mustache "person.last"
|
|
21
|
+
text ", "
|
|
22
|
+
mustache "person.first"
|
|
24
23
|
line_break
|
|
25
24
|
line_break
|
|
26
25
|
line_break
|
|
27
26
|
line_break
|
|
28
27
|
html tag="label"
|
|
29
28
|
html tag="input" bind:value=[object Object] placeholder="first" self_closing=true
|
|
30
|
-
|
|
29
|
+
soft_break
|
|
31
30
|
html tag="label"
|
|
32
31
|
html tag="input" bind:value=[object Object] placeholder="last" self_closing=true
|
|
33
32
|
line_break
|
|
@@ -35,15 +34,14 @@ root
|
|
|
35
34
|
html tag="div" class="buttons"
|
|
36
35
|
line_break
|
|
37
36
|
html tag="button" on:click=[object Object] disabled="{!first || !last}"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
text "create"
|
|
38
|
+
soft_break
|
|
39
|
+
text " "
|
|
41
40
|
html tag="button" on:click=[object Object] disabled="{!first || !last || !selected}"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
text "update"
|
|
42
|
+
soft_break
|
|
43
|
+
text " "
|
|
45
44
|
html tag="button" on:click=[object Object] disabled="{!selected}"
|
|
46
|
-
|
|
47
|
-
text "delete"
|
|
45
|
+
text "delete"
|
|
48
46
|
line_break
|
|
49
47
|
line_break
|
|
@@ -11,12 +11,11 @@ root
|
|
|
11
11
|
html tag="div" class="controls"
|
|
12
12
|
line_break
|
|
13
13
|
html tag="button" on:click="{() => travel(-1)}" disabled="{i === 0}"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
text "undo"
|
|
15
|
+
soft_break
|
|
16
|
+
text " "
|
|
17
17
|
html tag="button" on:click="{() => travel(+1)}" disabled="{i === undoStack.length -1}"
|
|
18
|
-
|
|
19
|
-
text "redo"
|
|
18
|
+
text "redo"
|
|
20
19
|
line_break
|
|
21
20
|
line_break
|
|
22
21
|
line_break
|
|
@@ -36,12 +35,12 @@ root
|
|
|
36
35
|
html tag="div" class="adjuster"
|
|
37
36
|
line_break
|
|
38
37
|
html tag="p"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
text "adjust diameter of circle at "
|
|
39
|
+
mustache "selected.cx"
|
|
40
|
+
text ", "
|
|
41
|
+
mustache "selected.cy"
|
|
42
|
+
soft_break
|
|
43
|
+
text " "
|
|
45
44
|
html tag="input" type="range" value=[object Object] on:input=[object Object] self_closing=true
|
|
46
45
|
line_break
|
|
47
46
|
line_break
|
|
@@ -8,14 +8,12 @@ root
|
|
|
8
8
|
html tag="article"
|
|
9
9
|
line_break
|
|
10
10
|
html tag="p" class="meta"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
mustache "comment.time_ago"
|
|
11
|
+
mustache "comment.user"
|
|
12
|
+
text " "
|
|
13
|
+
mustache "comment.time_ago"
|
|
15
14
|
line_break
|
|
16
15
|
line_break
|
|
17
|
-
|
|
18
|
-
svelte_tag tag="html" "comment.content"
|
|
16
|
+
svelte_tag tag="html" "comment.content"
|
|
19
17
|
line_break
|
|
20
18
|
line_break
|
|
21
19
|
html tag="div" class="replies"
|
|
@@ -6,8 +6,7 @@ root
|
|
|
6
6
|
line_break
|
|
7
7
|
line_break
|
|
8
8
|
html tag="a" href=[object Object]
|
|
9
|
-
|
|
10
|
-
text "« back"
|
|
9
|
+
text "« back"
|
|
11
10
|
line_break
|
|
12
11
|
line_break
|
|
13
12
|
html tag="article"
|
|
@@ -15,23 +14,20 @@ root
|
|
|
15
14
|
html tag="a" href="{item.url}"
|
|
16
15
|
line_break
|
|
17
16
|
html tag="h1"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
mustache "item.title"
|
|
18
|
+
soft_break
|
|
19
|
+
text " "
|
|
21
20
|
html tag="small"
|
|
22
|
-
|
|
23
|
-
mustache "item.domain"
|
|
21
|
+
mustache "item.domain"
|
|
24
22
|
line_break
|
|
25
23
|
line_break
|
|
26
24
|
line_break
|
|
27
25
|
html tag="p" class="meta"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
mustache "item.time_ago"
|
|
26
|
+
text "submitted by "
|
|
27
|
+
mustache "item.user"
|
|
28
|
+
text " "
|
|
29
|
+
mustache "item.time_ago"
|
|
33
30
|
line_break
|
|
34
|
-
paragraph
|
|
35
31
|
line_break
|
|
36
32
|
line_break
|
|
37
33
|
html tag="div" class="comments"
|
|
@@ -16,13 +16,11 @@ root
|
|
|
16
16
|
line_break
|
|
17
17
|
line_break
|
|
18
18
|
html tag="a" href="#/top/{page + 1}"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
mustache "page + 1"
|
|
19
|
+
text "page "
|
|
20
|
+
mustache "page + 1"
|
|
22
21
|
line_break
|
|
23
22
|
svelte_branch tag="else"
|
|
24
23
|
line_break
|
|
25
24
|
html tag="p" class="loading"
|
|
26
|
-
|
|
27
|
-
text "loading..."
|
|
25
|
+
text "loading..."
|
|
28
26
|
line_break
|
|
@@ -8,21 +8,17 @@ root
|
|
|
8
8
|
html tag="article"
|
|
9
9
|
line_break
|
|
10
10
|
html tag="span"
|
|
11
|
-
|
|
12
|
-
mustache "i + offset + 1"
|
|
11
|
+
mustache "i + offset + 1"
|
|
13
12
|
line_break
|
|
14
13
|
html tag="h2"
|
|
15
14
|
html tag="a" target="_blank" href=[object Object]
|
|
16
|
-
|
|
17
|
-
mustache "item.title"
|
|
15
|
+
mustache "item.title"
|
|
18
16
|
line_break
|
|
19
17
|
html tag="p" class="meta"
|
|
20
18
|
html tag="a" href="#/item/{item.id}"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
text " "
|
|
27
|
-
mustache "item.time_ago"
|
|
19
|
+
mustache "comment_text()"
|
|
20
|
+
text " by "
|
|
21
|
+
mustache "item.user"
|
|
22
|
+
text " "
|
|
23
|
+
mustache "item.time_ago"
|
|
28
24
|
line_break
|
|
@@ -6,8 +6,7 @@ root
|
|
|
6
6
|
line_break
|
|
7
7
|
line_break
|
|
8
8
|
html tag="h2"
|
|
9
|
-
|
|
10
|
-
text "Immutable"
|
|
9
|
+
text "Immutable"
|
|
11
10
|
line_break
|
|
12
11
|
svelte_block tag="each"
|
|
13
12
|
svelte_branch tag="each" "todos as todo"
|
|
@@ -17,8 +16,7 @@ root
|
|
|
17
16
|
line_break
|
|
18
17
|
line_break
|
|
19
18
|
html tag="h2"
|
|
20
|
-
|
|
21
|
-
text "Mutable"
|
|
19
|
+
text "Mutable"
|
|
22
20
|
line_break
|
|
23
21
|
svelte_block tag="each"
|
|
24
22
|
svelte_branch tag="each" "todos as todo"
|
|
@@ -8,11 +8,10 @@ root
|
|
|
8
8
|
html tag="div" class=[object Object]
|
|
9
9
|
line_break
|
|
10
10
|
html tag="p"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
text "I think you'll be surprised at some of your phrasing."
|
|
11
|
+
text "Did you enjoy your lunch, mom? You drank it fast enough. I know, I just call her Annabelle cause she's shaped like a…she's the belle of the ball"
|
|
12
|
+
text "! YOU'RE the Chiclet"
|
|
13
|
+
text "! Not me. Caw ca caw, caw ca caw, caw ca caw"
|
|
14
|
+
text "! A Colombian cartel that WON'T kidnap and kill you. You go buy a tape recorder and record yourself for a whole day. "
|
|
15
|
+
html tag="a" class=[object Object] href="https://bluthipsum.com/"
|
|
16
|
+
text "I think you'll be surprised at some of your phrasing."
|
|
18
17
|
line_break
|
|
@@ -11,11 +11,9 @@ root
|
|
|
11
11
|
html tag="div" class=[object Object]
|
|
12
12
|
line_break
|
|
13
13
|
html tag="div" class=[object Object]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
paragraph
|
|
18
|
-
text "in JS"
|
|
14
|
+
text "CSS"
|
|
15
|
+
soft_break
|
|
16
|
+
text " in JS"
|
|
19
17
|
line_break
|
|
20
18
|
line_break
|
|
21
19
|
paragraph
|
|
@@ -3,14 +3,13 @@ root
|
|
|
3
3
|
line_break
|
|
4
4
|
line_break
|
|
5
5
|
html tag="input" type="number" bind:value=[object Object] self_closing=true
|
|
6
|
-
|
|
6
|
+
soft_break
|
|
7
7
|
html tag="input" type="number" bind:value=[object Object] self_closing=true
|
|
8
8
|
line_break
|
|
9
9
|
line_break
|
|
10
10
|
html tag="p"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
mustache "a + b"
|
|
11
|
+
mustache "a"
|
|
12
|
+
text " + "
|
|
13
|
+
mustache "b"
|
|
14
|
+
text " = "
|
|
15
|
+
mustache "a + b"
|
|
@@ -2,7 +2,9 @@ import { describe, expect, test } from 'vitest';
|
|
|
2
2
|
|
|
3
3
|
import { get_all_child_kinds, get_content } from './utils';
|
|
4
4
|
|
|
5
|
-
import { parse_markdown_svelte } from '../src/main';
|
|
5
|
+
import { PFMParser, parse_markdown_svelte } from '../src/main';
|
|
6
|
+
import { TreeBuilder } from '../src/tree_builder';
|
|
7
|
+
import { print_ast } from './print';
|
|
6
8
|
|
|
7
9
|
describe('svelte expressions - inline', () => {
|
|
8
10
|
test('simple expression in paragraph', () => {
|
|
@@ -140,6 +142,84 @@ describe('svelte expressions - inline', () => {
|
|
|
140
142
|
const kinds = get_all_child_kinds(nodes, paragraph.index);
|
|
141
143
|
expect(kinds).not.toContain('mustache');
|
|
142
144
|
});
|
|
145
|
+
|
|
146
|
+
test.each([
|
|
147
|
+
['hi *{name}*', 'strong_emphasis'],
|
|
148
|
+
['hi _{name}_', 'emphasis'],
|
|
149
|
+
['hi ~{name}~', 'subscript'],
|
|
150
|
+
['hi ^{name}^', 'superscript'],
|
|
151
|
+
['hi ~~{name}~~', 'strikethrough'],
|
|
152
|
+
])('expression wrapped in delimiters: %s', (input, kind) => {
|
|
153
|
+
const { nodes } = parse_markdown_svelte(input);
|
|
154
|
+
|
|
155
|
+
const root = nodes.get_node();
|
|
156
|
+
const paragraph = nodes.get_node(root.children[0]);
|
|
157
|
+
expect(get_all_child_kinds(nodes, paragraph.index)).toEqual(['text', kind]);
|
|
158
|
+
|
|
159
|
+
const wrapper = nodes.get_node(paragraph.children[1]);
|
|
160
|
+
expect(get_all_child_kinds(nodes, wrapper.index)).toEqual(['mustache']);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('expression after text closes the delimiter', () => {
|
|
164
|
+
const input = '*a {name}* b';
|
|
165
|
+
const { nodes } = parse_markdown_svelte(input);
|
|
166
|
+
|
|
167
|
+
const root = nodes.get_node();
|
|
168
|
+
const paragraph = nodes.get_node(root.children[0]);
|
|
169
|
+
expect(get_all_child_kinds(nodes, paragraph.index)).toEqual([
|
|
170
|
+
'strong_emphasis',
|
|
171
|
+
'text',
|
|
172
|
+
]);
|
|
173
|
+
const strong = nodes.get_node(paragraph.children[0]);
|
|
174
|
+
expect(get_all_child_kinds(nodes, strong.index)).toEqual([
|
|
175
|
+
'text',
|
|
176
|
+
'mustache',
|
|
177
|
+
]);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test('nested delimiters around an expression', () => {
|
|
181
|
+
const input = '*_{name}_*';
|
|
182
|
+
const { nodes } = parse_markdown_svelte(input);
|
|
183
|
+
|
|
184
|
+
const root = nodes.get_node();
|
|
185
|
+
const paragraph = nodes.get_node(root.children[0]);
|
|
186
|
+
const strong = nodes.get_node(paragraph.children[0]);
|
|
187
|
+
expect(strong.kind).toBe('strong_emphasis');
|
|
188
|
+
const emphasis = nodes.get_node(strong.children[0]);
|
|
189
|
+
expect(emphasis.kind).toBe('emphasis');
|
|
190
|
+
expect(get_all_child_kinds(nodes, emphasis.index)).toEqual(['mustache']);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test('svelte tag wrapped in delimiters', () => {
|
|
194
|
+
const input = '*{@html x}*';
|
|
195
|
+
const { nodes } = parse_markdown_svelte(input);
|
|
196
|
+
|
|
197
|
+
const root = nodes.get_node();
|
|
198
|
+
const paragraph = nodes.get_node(root.children[0]);
|
|
199
|
+
const strong = nodes.get_node(paragraph.children[0]);
|
|
200
|
+
expect(strong.kind).toBe('strong_emphasis');
|
|
201
|
+
expect(get_all_child_kinds(nodes, strong.index)).toEqual(['svelte_tag']);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test('delimiters around expressions match when fed in chunks', () => {
|
|
205
|
+
const input = '*{name}* b ~~{a}~~ ^{b}^ ~{c}~ _{d}_';
|
|
206
|
+
const expected = print_ast(parse_markdown_svelte(input).nodes, input);
|
|
207
|
+
expect(expected).toBe(
|
|
208
|
+
'root\n paragraph\n strong_emphasis\n mustache "name"\n text " b "\n strikethrough\n mustache "a"\n text " "\n superscript\n mustache "b"\n text " "\n subscript\n mustache "c"\n text " "\n emphasis\n mustache "d"'
|
|
209
|
+
);
|
|
210
|
+
for (let size = 1; size <= 8; size++) {
|
|
211
|
+
const tree = new TreeBuilder(input.length);
|
|
212
|
+
const parser = new PFMParser(tree);
|
|
213
|
+
parser.init();
|
|
214
|
+
for (let i = 0; i < input.length; i += size) {
|
|
215
|
+
parser.feed(input.slice(i, i + size));
|
|
216
|
+
}
|
|
217
|
+
parser.finish();
|
|
218
|
+
expect(print_ast(tree.get_buffer(), input), `chunk size ${size}`).toBe(
|
|
219
|
+
expected
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
143
223
|
});
|
|
144
224
|
|
|
145
225
|
describe('svelte expressions - HTML attributes', () => {
|
|
@@ -151,7 +231,10 @@ describe('svelte expressions - HTML attributes', () => {
|
|
|
151
231
|
const html = nodes.get_node(root.children[0]);
|
|
152
232
|
expect(html.kind).toBe('html');
|
|
153
233
|
expect(html.metadata.tag).toBe('div');
|
|
154
|
-
expect(html.metadata.attributes.class).toEqual({
|
|
234
|
+
expect(html.metadata.attributes.class).toEqual({
|
|
235
|
+
type: 'expression',
|
|
236
|
+
value: 'styles',
|
|
237
|
+
});
|
|
155
238
|
});
|
|
156
239
|
|
|
157
240
|
test('expression attribute with complex value', () => {
|
|
@@ -160,7 +243,10 @@ describe('svelte expressions - HTML attributes', () => {
|
|
|
160
243
|
|
|
161
244
|
const root = nodes.get_node();
|
|
162
245
|
const html = nodes.get_node(root.children[0]);
|
|
163
|
-
expect(html.metadata.attributes.class).toEqual({
|
|
246
|
+
expect(html.metadata.attributes.class).toEqual({
|
|
247
|
+
type: 'expression',
|
|
248
|
+
value: 'active ? "on" : "off"',
|
|
249
|
+
});
|
|
164
250
|
});
|
|
165
251
|
|
|
166
252
|
test('shorthand expression attribute', () => {
|
|
@@ -170,6 +256,9 @@ describe('svelte expressions - HTML attributes', () => {
|
|
|
170
256
|
const root = nodes.get_node();
|
|
171
257
|
const html = nodes.get_node(root.children[0]);
|
|
172
258
|
expect(html.metadata.tag).toBe('div');
|
|
173
|
-
expect(html.metadata.attributes.class).toEqual({
|
|
259
|
+
expect(html.metadata.attributes.class).toEqual({
|
|
260
|
+
type: 'expression',
|
|
261
|
+
value: 'class',
|
|
262
|
+
});
|
|
174
263
|
});
|
|
175
264
|
});
|
package/test/svelte_tags.spec.ts
CHANGED
|
@@ -10,8 +10,7 @@ describe('svelte void tags - {@tag ...}', () => {
|
|
|
10
10
|
const { nodes } = parse_markdown_svelte(input);
|
|
11
11
|
|
|
12
12
|
const root = nodes.get_node();
|
|
13
|
-
const
|
|
14
|
-
const tag = nodes.get_node(paragraph.children[0]);
|
|
13
|
+
const tag = nodes.get_node(root.children[0]);
|
|
15
14
|
expect(tag.kind).toBe('svelte_tag');
|
|
16
15
|
expect(tag.metadata.tag).toBe('html');
|
|
17
16
|
const { content, value } = get_content(nodes, tag.index, input);
|
|
@@ -24,8 +23,7 @@ describe('svelte void tags - {@tag ...}', () => {
|
|
|
24
23
|
const { nodes } = parse_markdown_svelte(input);
|
|
25
24
|
|
|
26
25
|
const root = nodes.get_node();
|
|
27
|
-
const
|
|
28
|
-
const tag = nodes.get_node(paragraph.children[0]);
|
|
26
|
+
const tag = nodes.get_node(root.children[0]);
|
|
29
27
|
expect(tag.kind).toBe('svelte_tag');
|
|
30
28
|
expect(tag.metadata.tag).toBe('debug');
|
|
31
29
|
const { value } = get_content(nodes, tag.index, input);
|
|
@@ -37,8 +35,7 @@ describe('svelte void tags - {@tag ...}', () => {
|
|
|
37
35
|
const { nodes } = parse_markdown_svelte(input);
|
|
38
36
|
|
|
39
37
|
const root = nodes.get_node();
|
|
40
|
-
const
|
|
41
|
-
const tag = nodes.get_node(paragraph.children[0]);
|
|
38
|
+
const tag = nodes.get_node(root.children[0]);
|
|
42
39
|
expect(tag.kind).toBe('svelte_tag');
|
|
43
40
|
expect(tag.metadata.tag).toBe('const');
|
|
44
41
|
const { value } = get_content(nodes, tag.index, input);
|
|
@@ -50,8 +47,7 @@ describe('svelte void tags - {@tag ...}', () => {
|
|
|
50
47
|
const { nodes } = parse_markdown_svelte(input);
|
|
51
48
|
|
|
52
49
|
const root = nodes.get_node();
|
|
53
|
-
const
|
|
54
|
-
const tag = nodes.get_node(paragraph.children[0]);
|
|
50
|
+
const tag = nodes.get_node(root.children[0]);
|
|
55
51
|
expect(tag.kind).toBe('svelte_tag');
|
|
56
52
|
expect(tag.metadata.tag).toBe('render');
|
|
57
53
|
const { value } = get_content(nodes, tag.index, input);
|
|
@@ -78,8 +74,7 @@ describe('svelte void tags - {@tag ...}', () => {
|
|
|
78
74
|
const { nodes } = parse_markdown_svelte(input);
|
|
79
75
|
|
|
80
76
|
const root = nodes.get_node();
|
|
81
|
-
const
|
|
82
|
-
const tag = nodes.get_node(paragraph.children[0]);
|
|
77
|
+
const tag = nodes.get_node(root.children[0]);
|
|
83
78
|
expect(tag.kind).toBe('svelte_tag');
|
|
84
79
|
expect(tag.metadata.tag).toBe('debug');
|
|
85
80
|
// No value, tag has no expression content
|
|
@@ -92,14 +87,34 @@ describe('svelte void tags - {@tag ...}', () => {
|
|
|
92
87
|
const { nodes } = parse_markdown_svelte(input);
|
|
93
88
|
|
|
94
89
|
const root = nodes.get_node();
|
|
95
|
-
const
|
|
96
|
-
const tag = nodes.get_node(paragraph.children[0]);
|
|
90
|
+
const tag = nodes.get_node(root.children[0]);
|
|
97
91
|
expect(tag.kind).toBe('svelte_tag');
|
|
98
92
|
expect(tag.metadata.tag).toBe('html');
|
|
99
93
|
const { value } = get_content(nodes, tag.index, input);
|
|
100
94
|
expect(value).toBe('items.map(i => `<li>${i}</li>`).join("")');
|
|
101
95
|
});
|
|
102
96
|
|
|
97
|
+
test('a tag with text keeps its paragraph', () => {
|
|
98
|
+
const input = '{@html raw} after\n';
|
|
99
|
+
const { nodes } = parse_markdown_svelte(input);
|
|
100
|
+
|
|
101
|
+
const root = nodes.get_node();
|
|
102
|
+
const paragraph = nodes.get_node(root.children[0]);
|
|
103
|
+
expect(paragraph.kind).toBe('paragraph');
|
|
104
|
+
expect(get_all_child_kinds(nodes, paragraph.index)).toEqual([
|
|
105
|
+
'svelte_tag',
|
|
106
|
+
'text',
|
|
107
|
+
]);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('a plain expression is text and keeps its paragraph', () => {
|
|
111
|
+
const input = '{title}\n';
|
|
112
|
+
const { nodes } = parse_markdown_svelte(input);
|
|
113
|
+
|
|
114
|
+
const paragraph = nodes.get_node(nodes.get_node().children[0]);
|
|
115
|
+
expect(paragraph.kind).toBe('paragraph');
|
|
116
|
+
});
|
|
117
|
+
|
|
103
118
|
test('not parsed inside code span', () => {
|
|
104
119
|
const input = '`{@html raw}`';
|
|
105
120
|
const { nodes } = parse_markdown_svelte(input);
|