diff options
author | 2022-02-07 13:31:02 -0300 | |
---|---|---|
committer | 2022-02-07 08:31:02 -0800 | |
commit | 2bc91543ceeb5f3dd45e201bf75d79f186e85141 (patch) | |
tree | 0b001adedd69a248746974462640f081f7a351f9 /packages/markdown/remark/src/index.ts | |
parent | 0caf9169bc0867f41332bd2cc8ab0066b39d286e (diff) | |
download | astro-2bc91543ceeb5f3dd45e201bf75d79f186e85141.tar.gz astro-2bc91543ceeb5f3dd45e201bf75d79f186e85141.tar.zst astro-2bc91543ceeb5f3dd45e201bf75d79f186e85141.zip |
feat: Added the ability to add custom themes/languages to Shiki (#2518)
* Replaced `shikiTheme` with `shikiConfig`
* Code.astro now accepts custom themes/langs
* Updated docs
* Updated tests
* Fixed language loading
* Added customization examples
* Updated documentation
* Added more tests
* Changelogs
* Changed some spaces to tabs
* Fixed typo in changesets
* Moved tests fixtures
* Rolled back changes to with-markdown-shiki
* Removed lang example in docs
* Optimized Code component
* Try to fix windows errors
* Try to see if this new tests work
Diffstat (limited to 'packages/markdown/remark/src/index.ts')
-rw-r--r-- | packages/markdown/remark/src/index.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts index 78d645227..e8a315ef1 100644 --- a/packages/markdown/remark/src/index.ts +++ b/packages/markdown/remark/src/index.ts @@ -39,7 +39,7 @@ export async function renderMarkdown(content: string, opts?: MarkdownRenderingOp const scopedClassName = opts?.$?.scopedClassName; const mode = opts?.mode ?? 'mdx'; const syntaxHighlight = opts?.syntaxHighlight ?? 'prism'; - const shikiTheme = opts?.shikiTheme ?? 'github-dark'; + const shikiConfig = opts?.shikiConfig ?? {}; const isMDX = mode === 'mdx'; const { headers, rehypeCollectHeaders } = createCollectHeaders(); @@ -70,7 +70,7 @@ export async function renderMarkdown(content: string, opts?: MarkdownRenderingOp if (syntaxHighlight === 'prism') { parser.use([remarkPrism(scopedClassName)]); } else if (syntaxHighlight === 'shiki') { - parser.use([await remarkShiki(shikiTheme)]); + parser.use([await remarkShiki(shikiConfig)]); } parser.use([[markdownToHtml as any, { allowDangerousHtml: true, passThrough: ['raw', 'mdxTextExpression', 'mdxJsxTextElement', 'mdxJsxFlowElement'] }]]); |