summaryrefslogtreecommitdiff
path: root/docs/src/pages
diff options
context:
space:
mode:
authorGravatar Juan Martín Seery <me@juanm04.com> 2022-01-31 19:14:07 -0300
committerGravatar GitHub <noreply@github.com> 2022-01-31 16:14:07 -0600
commit6fe1b0279fce5a7a0e90ff79746ea0b641da3e21 (patch)
treec2924bfd3e2c131d135cc8b2ceecbec310c6be56 /docs/src/pages
parent618a16f59d4037cff1665110f0ed111a96a96437 (diff)
downloadastro-6fe1b0279fce5a7a0e90ff79746ea0b641da3e21.tar.gz
astro-6fe1b0279fce5a7a0e90ff79746ea0b641da3e21.tar.zst
astro-6fe1b0279fce5a7a0e90ff79746ea0b641da3e21.zip
Add Shiki as an alternative to Prism (#2497)
* [ci] yarn format * Added shiki to markdown-remark * Upgraded astro shiki * Added minimal example * Changed defaults to match <Code /> * Replace `shiki` with `astro` classes * Added documentation * Updated Astro code to use new `codeToHtml` * Added changesets * Added basic test * Updated tests a bit Co-authored-by: JuanM04 <JuanM04@users.noreply.github.com>
Diffstat (limited to 'docs/src/pages')
-rw-r--r--docs/src/pages/en/guides/markdown-content.md22
1 files changed, 21 insertions, 1 deletions
diff --git a/docs/src/pages/en/guides/markdown-content.md b/docs/src/pages/en/guides/markdown-content.md
index 8233a8af4..b5e33d5b2 100644
--- a/docs/src/pages/en/guides/markdown-content.md
+++ b/docs/src/pages/en/guides/markdown-content.md
@@ -33,7 +33,6 @@ In addition to custom components inside the [`<Markdown>` component](/en/guides/
- [GitHub-flavored Markdown](https://github.com/remarkjs/remark-gfm)
- [remark-smartypants](https://github.com/silvenon/remark-smartypants)
- [rehype-slug](https://github.com/rehypejs/rehype-slug)
-- [Prism](https://prismjs.com/)
Also, Astro supports third-party plugins for Markdown. You can provide your plugins in `astro.config.mjs`.
@@ -85,6 +84,27 @@ export default {
};
```
+### Syntax Highlighting
+
+Astro comes with built-in support for [Prism](https://prismjs.com/) and [Shiki](https://shiki.matsu.io/). By default, Prism is enabled. You can modify this behavior by updating the `@astrojs/markdown-remark` options:
+
+```js
+// astro.config.mjs
+export default {
+ markdownOptions: {
+ render: [
+ '@astrojs/markdown-remark',
+ {
+ // Pick a syntax highlighter. Can be 'prism' (default), 'shiki' or false to disable any highlighting.
+ syntaxHighlight: 'prism',
+ // If you are using shiki, here you can define a global theme.
+ shikiTheme: 'github-dark',
+ },
+ ],
+ },
+};
+```
+
## Markdown Pages
Astro treats any `.md` files inside of the `/src/pages` directory as pages. These files can contain frontmatter, but are otherwise processed as plain markdown files and do not support components. If you're looking to embed rich components in your markdown, take a look at the [Markdown Component](#astros-markdown-component) section.