Skip to content

Commit

Permalink
fix(rehype): support special languages (#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuma-nama authored Oct 24, 2024
1 parent f76a371 commit b8471aa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/rehype/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { Root } from 'hast'
import type { Transformer } from 'unified'
import type { RehypeShikiHandler } from './handlers'
import type { RehypeShikiCoreOptions } from './types'
import { isSpecialLang } from 'shiki/core'
import { visit } from 'unist-util-visit'
import { InlineCodeHandlers, PreHandler } from './handlers'

Expand Down Expand Up @@ -92,7 +93,7 @@ function rehypeShikiFromHighlighter(
if (!lang)
return defaultLanguage

if (highlighter.getLoadedLanguages().includes(lang))
if (highlighter.getLoadedLanguages().includes(lang) || isSpecialLang(lang))
return lang

if (lazy) {
Expand Down
3 changes: 2 additions & 1 deletion packages/rehype/test/fixtures/a.core.out.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/rehype/test/fixtures/a.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/rehype/test/fixtures/a.out.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b8471aa

Please sign in to comment.