-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86b6143
commit b6e96b2
Showing
19 changed files
with
74 additions
and
35 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<script context="module"> | ||
export { default as Heading } from './Heading.svelte'; | ||
export { default as Fence } from './Fence.svelte'; | ||
export { default as Heading } from './nodes/Heading.svelte'; | ||
export { default as Fence } from './nodes/Fence.svelte'; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<script context="module"> | ||
export { default as Addition } from './tags/Addition.svelte'; | ||
export { default as Multiply } from './tags/Multiply.svelte'; | ||
</script> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<slot /> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Nested | ||
|
||
I am a nested partial. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Partial | ||
|
||
I am a partial. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Partial with variable | ||
|
||
{% $name %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## Partials | ||
|
||
You pass a directory to the configuration and it will automatically load all files to be used as [partials](https://markdoc.dev/docs/partials). | ||
|
||
```js | ||
// svelte.config.js | ||
markdoc({ | ||
partials: join(dirname(fileURLToPath(import.meta.url)), './src/lib/partials'), | ||
}) | ||
``` | ||
|
||
```md | ||
<!-- ./src/lib/partials/header.md --> | ||
# My header | ||
``` | ||
|
||
Here's an example of including the `header.md` file as a partial. | ||
|
||
```md | ||
<!-- ./src/routes/+page.markdoc --> | ||
{% partial file="header.md" /%} | ||
``` | ||
|
||
### Passing variables | ||
|
||
Partials are like any other tags, so you can pass variables as attributes to them such as: | ||
|
||
```md | ||
<!-- ./src/routes/+page.markdoc --> | ||
{% partial file="header.md" variables={name: "My header name"} /%} | ||
``` | ||
|
||
and access the variables as you would in a regular Markdoc document: | ||
|
||
```md | ||
<!-- ./src/lib/partials/header.md --> | ||
# {% $name %} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
{% mytest %} | ||
I am slot content. | ||
{% /mytest %} | ||
{% addition a=4 b=4 /%} | ||
|
||
{% addition a=4 b=6 /%} | ||
{% multiply a=3 b=8 /%} | ||
|
||
{% partial file="test.md" /%} | ||
|
||
{% partial file="nested/file.md" /%} | ||
|
||
{% partial | ||
file="variable.md" | ||
variables={name: "I am passed to a variable."} /%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.