Skip to content

Commit

Permalink
feat: support highlighting ansi
Browse files Browse the repository at this point in the history
  • Loading branch information
norskeld committed Feb 26, 2023
1 parent 0a452ed commit 37986d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/shikigami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ async function shikigami(userOptions: ShikigamiOptions = {}): Promise<PluginSimp
const withLanguage = meta.withLanguage ?? options.withLanguage
const withLineNumbers = meta.withLineNumbers ?? options.withLineNumbers

const themedTokensRaw = highlighter.codeToThemedTokens(markdownContent, languageId)
const themedTokensRaw =
// Treat 'ansi' differently.
languageId === 'ansi'
? highlighter.ansiToThemedTokens(markdownContent)
: highlighter.codeToThemedTokens(markdownContent, languageId)

const themedTokens = filterOutTrailingEmptyTokens(themedTokensRaw)

const lineOptions = createLineOptions(
Expand Down

0 comments on commit 37986d8

Please sign in to comment.