Skip to content

Commit c5b209c

Browse files
authored
✨ IMPROVE: Add support for Svelte chunks (#32)
1 parent c8c9654 commit c5b209c

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

syntaxes/myst.tmLanguage

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@
353353
<key>include</key>
354354
<string>#directive-code-shell</string>
355355
</dict>
356+
<dict>
357+
<key>include</key>
358+
<string>#directive-code-svelte</string>
359+
</dict>
356360
<dict>
357361
<key>include</key>
358362
<string>#directive-code-ts</string>
@@ -2825,6 +2829,90 @@
28252829
</dict>
28262830
</array>
28272831
</dict>
2832+
<key>directive-code-svelte</key>
2833+
<dict>
2834+
<key>begin</key>
2835+
<string>(^|\G)(\s*)(\`{3,}|~{3,})\s*\{(code|code-block|code-cell)\}\s*(?i:(svelte)((\s+|:|\{)[^\`~]*)?$)</string>
2836+
<key>name</key>
2837+
<string>markup.directive.code.myst</string>
2838+
<key>end</key>
2839+
<string>(^|\G)(\2|\s{0,3})(\3)\s*$</string>
2840+
<key>beginCaptures</key>
2841+
<dict>
2842+
<key>3</key>
2843+
<dict>
2844+
<key>name</key>
2845+
<string>punctuation.definition.myst</string>
2846+
</dict>
2847+
<key>4</key>
2848+
<dict>
2849+
<key>name</key>
2850+
<string>support.class.directive.myst</string>
2851+
</dict>
2852+
<key>5</key>
2853+
<dict>
2854+
<key>name</key>
2855+
<string>support.variable.language.myst</string>
2856+
</dict>
2857+
</dict>
2858+
<key>endCaptures</key>
2859+
<dict>
2860+
<key>3</key>
2861+
<dict>
2862+
<key>name</key>
2863+
<string>punctuation.definition.myst</string>
2864+
</dict>
2865+
</dict>
2866+
<key>patterns</key>
2867+
<array>
2868+
<dict>
2869+
<key>begin</key>
2870+
<string>(^|\G)(\s*)(.*)</string>
2871+
<key>while</key>
2872+
<string>(^|\G)(?!\s*([\`~]{3,})\s*$)</string>
2873+
<key>contentName</key>
2874+
<string>meta.embedded.block.svelte</string>
2875+
<key>patterns</key>
2876+
<array>
2877+
<dict>
2878+
<key>begin</key>
2879+
<string>(^|\G)(-{3})\s*$</string>
2880+
<key>beginCaptures</key>
2881+
<dict>
2882+
<key>1</key>
2883+
<dict>
2884+
<key>name</key>
2885+
<string>punctuation.options.myst</string>
2886+
</dict>
2887+
</dict>
2888+
<key>end</key>
2889+
<string>(^|\G)(-{3})\s*$</string>
2890+
<key>endCaptures</key>
2891+
<dict>
2892+
<key>2</key>
2893+
<dict>
2894+
<key>name</key>
2895+
<string>punctuation.options.myst</string>
2896+
</dict>
2897+
</dict>
2898+
<key>contentName</key>
2899+
<string>meta.embedded.block.options</string>
2900+
<key>patterns</key>
2901+
<array>
2902+
<dict>
2903+
<key>include</key>
2904+
<string>source.yaml</string>
2905+
</dict>
2906+
</array>
2907+
</dict>
2908+
<dict>
2909+
<key>include</key>
2910+
<string>source.svelte</string>
2911+
</dict>
2912+
</array>
2913+
</dict>
2914+
</array>
2915+
</dict>
28282916
<key>directive-code-ts</key>
28292917
<dict>
28302918
<key>begin</key>

template/languages.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,13 @@
396396
name: shell
397397
sources:
398398
- source.shell
399+
- identifiers:
400+
- svelte
401+
language: svelte
402+
name: svelte
403+
sources:
404+
- source.svelte
405+
allow_yaml: true
399406
- identifiers:
400407
- typescript
401408
- ts

0 commit comments

Comments
 (0)