Skip to content

Conversation

jpg619
Copy link
Contributor

@jpg619 jpg619 commented Oct 2, 2024

WHAT

This pull request includes changes to improve the syntax highlighting in the src/mdx/code.js file by introducing a color mapping for different token types and simplifying the code structure.

Improvements to syntax highlighting:

  • src/mdx/code.js: Added a colorMap object to define custom colors for specific token types such as comments, parameter variables, and functions.

Code simplification:

  • src/mdx/code.js: Refactored the Code component to use the colorMap for setting token colors, simplifying the logic for applying styles to tokens.

WHY

BEFORE

screen shot before colour red before colour blue before

AFTER

screen shot after colour red after colour blue after

@jpg619 jpg619 self-assigned this Oct 2, 2024
@jpg619 jpg619 changed the title Refactor code.js to improve syntax highlighting colors [Fix Accessibility Bug] Refactor code.js to improve syntax highlighting colors Oct 2, 2024
@jpg619 jpg619 requested a review from wraithgar October 2, 2024 16:43
@jpg619 jpg619 marked this pull request as ready for review October 2, 2024 16:43
@jpg619 jpg619 removed the request for review from monishcm October 2, 2024 16:44
@wraithgar
Copy link
Member

Isn't this the kind of thing css styles is designed to solve? Can we not set this color based on the class in css?

@jpg619 jpg619 marked this pull request as draft October 3, 2024 14:40
@jpg619 jpg619 marked this pull request as ready for review October 9, 2024 16:07
@jpg619 jpg619 marked this pull request as draft October 9, 2024 16:10
@jpg619 jpg619 marked this pull request as ready for review October 9, 2024 16:50
@wraithgar wraithgar merged commit 6ff91a4 into main Oct 9, 2024
9 checks passed
@wraithgar wraithgar deleted the jpg619/fix-accessibility-bug-9187 branch October 9, 2024 17:11
wraithgar pushed a commit that referenced this pull request Oct 10, 2024
…ken assign-left variable' (#1318)

## WHAT
This pull request includes a small change to the `src/mdx/code.js` file.
The change adds a new color mapping for the 'token assign-left variable'
to the `colorMap` object.

*
[`src/mdx/code.js`](diffhunk://#diff-f3f4e897983cba6337e020c78ef03c356c88f8868bcd19c465eb3c07e8b96625R50):
Added color mapping for 'token assign-left variable' in the `colorMap`
object.

## BEFORE & AFTER
<img width="375" alt="image"
src="https://github.com/user-attachments/assets/f8bf78f4-f2cb-43b7-8b3c-e199e9ce9b33">
<img width="375" alt="image"
src="https://github.com/user-attachments/assets/1af726ff-e629-4a60-a565-1d1278a9ff7d">

<img width="242" alt="image"
src="https://github.com/user-attachments/assets/7f1db9d9-d4ea-470e-a5e5-aa91fad1125b">
<img width="242" alt="image"
src="https://github.com/user-attachments/assets/58c1ca81-8799-4169-a3dd-5253afda5289">




## Reference
Missed in the [Previous
PR](#1305)
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.

2 participants