Skip to content

Posts: support HLJS style#56

Merged
gapry merged 2 commits intomainfrom
HLJS
Apr 1, 2026
Merged

Posts: support HLJS style#56
gapry merged 2 commits intomainfrom
HLJS

Conversation

@gapry
Copy link
Copy Markdown
Owner

@gapry gapry commented Apr 1, 2026

No description provided.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

This PR successfully adds Highlight.js support for assembly language syntax highlighting (x86asm, armasm) while maintaining Prism for other languages. The implementation correctly:

  • Imports both Prism and HLJS highlighters with appropriate styles
  • Conditionally routes assembly languages to HLJS and other languages to Prism
  • Updates layout consistency by standardizing max-width to 1024px across components
  • Converts markdown code blocks to use the appropriate language identifiers

The code is well-structured and functionally correct. No blocking issues identified.


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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates several blog posts to use specific assembly language tags (x86asm and armasm) for code blocks and increases the application's maximum layout width from 800px to 1024px. In the MarkdownRenderer, a dual-highlighter system is introduced to support these new languages using Highlight.js alongside Prism. However, the implementation of the light version of Highlight.js is missing the necessary language registration, which will prevent the assembly code from being highlighted correctly. Additionally, using two different highlighting engines may negatively impact bundle size and visual consistency.

Comment on lines +7 to +12
import { Light as HLJSHighlighter } from 'react-syntax-highlighter';
import { atomDark as PrismStyles } from 'react-syntax-highlighter/dist/esm/styles/prism';
import { darcula as HLJSStyles } from 'react-syntax-highlighter/dist/esm/styles/hljs';
import './MarkdownRenderer.css'

const HLJS_LANGS = ['x86asm', 'armasm'];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

When using the Light build of react-syntax-highlighter, languages must be manually registered using registerLanguage. Without this registration, the x86asm and armasm code blocks will not be highlighted and will likely fall back to plain text.

Additionally, importing both Prism and HLJS engines, along with two different themes (atomDark and darcula), significantly increases the bundle size and may lead to visual inconsistency across different code blocks. Since Prism already supports assembly dialects (e.g., asm64 or armasm), you might consider using a single highlighting engine for the entire project.

import { Light as HLJSHighlighter } from 'react-syntax-highlighter';
import x86asm from 'react-syntax-highlighter/dist/esm/languages/hljs/x86asm';
import armasm from 'react-syntax-highlighter/dist/esm/languages/hljs/armasm';
import { atomDark as PrismStyles } from 'react-syntax-highlighter/dist/esm/styles/prism';
import { darcula as HLJSStyles } from 'react-syntax-highlighter/dist/esm/styles/hljs';
import './MarkdownRenderer.css'

HLJSHighlighter.registerLanguage('x86asm', x86asm);
HLJSHighlighter.registerLanguage('armasm', armasm);

const HLJS_LANGS = ['x86asm', 'armasm'];

@gapry gapry merged commit 189dcdd into main Apr 1, 2026
1 check passed
@gapry gapry deleted the HLJS branch April 1, 2026 21:56
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