Skip to content

highlight: replace Prism with Shiki - #62

Merged
gapry merged 1 commit into
mainfrom
shikijs
Nov 29, 2026
Merged

gapry merged 1 commit into
mainfrom
shikijs

Conversation

@gapry

@gapry gapry commented Nov 29, 2026

Copy link
Copy Markdown
Owner

No description provided.

@amazon-q-developer

Copy link
Copy Markdown

Warning

Amazon Q Developer for GitHub: end of support

On January 30, 2027, AWS will discontinue support for the Amazon Q Developer for GitHub App. New app installations will no longer be available starting November 18, 2026.

For capabilities similar to the Amazon Q Developer for GitHub App, explore Kiro and the Kiro GitHub App. For more information about the end of support, see Amazon Q Developer end-of-support announcement on the AWS DevOps Blog.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

This PR replaces Prism with Shiki for syntax highlighting. The overall approach — using createHighlighterCore with a module-level promise singleton, tree-shaking individual language grammars, and wiring via a rehype plugin — is sound.

One issue flagged:

In theme.js, the spread ...darkPlus.colors will throw a runtime TypeError if darkPlus.colors is undefined. Some Shiki theme .mjs exports may not populate the colors map on the top-level object depending on the Shiki version. Add a defensive guard (...( darkPlus.colors ?? {})) to prevent a crash when the theme object's shape changes across Shiki versions.

No other blocking defects were found. The dynamic import in MarkdownRenderer.jsx is correctly cached by the module system, the highlighterPromise singleton is properly reused, and langAlias for console → shellsession is correctly registered.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment on lines +6 to +7
...darkPlus.colors,
'editor.background': 'var(--color-code-bg)',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Logic Error: Shiki resolves theme colors statically at highlight time and injects them as literal inline style attribute values. Setting 'editor.background': 'var(--color-code-bg)' will cause Shiki to emit style="background-color:var(--color-code-bg)" literally in the HTML output — this only works if the consuming environment (a browser with the CSS variable defined on a parent element) can resolve it at render time. While browsers can resolve CSS variables in inline styles, Shiki also uses editor.background to set the background-color on the <pre> tag's inline style, so the runtime CSS variable resolution will work in browsers. However, if darkPlus.colors is undefined (some Shiki theme objects may not have a colors property populated on the imported .mjs module), the spread ...darkPlus.colors will throw a runtime error. Verify that darkPlus.colors is always defined before spreading it.

@gapry
gapry merged commit e23bb02 into main Nov 29, 2026
2 checks passed
@gapry
gapry deleted the shikijs branch November 29, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant