You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Astro v4.5.9
Node v20.3.0
System Linux (x64)
Package Manager npm
Output static
Adapter none
Integrations @astrojs/tailwind
@astrojs/mdx
@astrojs/sitemap
Describe the Bug
Shiki's built-in ANSI language isn't correctly rendering.
When attempting to render a code block with the ansi language, the following console log can be observed:
[Shiki] The language "ansi" doesn't exist, falling back to "plaintext".
As a side note, out of the hard coded Shiki languages: ansi, plaintext, txt, text, and plain, only plaintext works. (The others fail with a similar error message as above)
Likely culprit
While I cannot test this directly (due to the lack of knowledge about testing and developing on this particular project), there is this line which I have found in the code which I believe to be a likely culprit.
What should happen is the ANSI correctly renders with colors. A working example to contrast the Stackblitz link (with the same content used as in the Stackblitz link) can be found here, on Shiki's documentation.
Likely fix
My hunch is that (with again, no way to test or prove it) that the above code snippet should be using the following function inside Shiki itself instead of just checking the plaintext case:
Astro Info
Describe the Bug
Shiki's built-in ANSI language isn't correctly rendering.
When attempting to render a code block with the
ansi
language, the following console log can be observed:As a side note, out of the hard coded Shiki languages:
ansi
,plaintext
,txt
,text
, andplain
, onlyplaintext
works. (The others fail with a similar error message as above)Likely culprit
While I cannot test this directly (due to the lack of knowledge about testing and developing on this particular project), there is this line which I have found in the code which I believe to be a likely culprit.
astro/packages/markdown/remark/src/shiki.ts
Line 54 in 1cd2a74
What's the expected result?
What should happen is the ANSI correctly renders with colors. A working example to contrast the Stackblitz link (with the same content used as in the Stackblitz link) can be found here, on Shiki's documentation.
Likely fix
My hunch is that (with again, no way to test or prove it) that the above code snippet should be using the following function inside Shiki itself instead of just checking the
plaintext
case:https://github.com/shikijs/shiki/blob/ec2bffae1c5cf9ab9e3fcc12a8ed1a5143e99707/packages/core/src/utils.ts#L41
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-bse4te?file=src%2Fpages%2Findex.mdx
Participation
EDIT: After figuring it out, I think the fix works! Going to PR now.
The text was updated successfully, but these errors were encountered: