Svelte in markdown
This feature allows you to write
<style>
, <script>
, <script context="module">
, #if
, #each
, #await
, @html
, @const
, <svelte:xxx>
in .md files
Basic
Here's a basic example with #if
, #each
, #await
, @html
, @const
Output
Input
- 1: foo
- 2: bar
- 3: zoo
Fail
Loading
Content render with @html
Syntax Restrictions
Always use quotes in markdown files.
-
+
<script>
let count = 0
</script>
<button on:click={() => count ++}></button>
<button on:click="{() => count ++}"></button>
svelte
A Counter
Output
Input
A counter
Import svelte in md
Output
Input
Counter.svelte
On this page