Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom colors to markdown code block for syntax highlighting #26554

Conversation

anuthebananu
Copy link
Contributor

@anuthebananu anuthebananu commented Dec 17, 2024

Summary & Motivation

Default syntax highlighting colors from highlight.js were not always clearly visible in dark mode. Adding our custom colors improves the contrast and ensures we'll always have good contrast in light and dark mode.

How I Tested These Changes

run dagster dev on the sample dbt project and look at dbt asset descriptions.

Below are screenshots of various sql code blocks from the dbt asset descriptions, illustrating the new colors in light and dark mode.

image.png

image.png

image.png

image.png

image.png

image.png

Changelog

Insert changelog entry or delete this section.

Copy link
Contributor Author

anuthebananu commented Dec 17, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

@anuthebananu anuthebananu changed the title add custom colors to markdown code block for syntax highlighting Add custom colors to markdown code block for syntax highlighting Dec 17, 2024
@anuthebananu anuthebananu marked this pull request as ready for review December 17, 2024 20:48
@anuthebananu anuthebananu added the area: UI/UX Related to User Interface and User Experience label Dec 17, 2024 — with Graphite App
@salazarm
Copy link
Contributor

looks like you need to run lint to format your changes

Copy link
Contributor Author

weird. i would have expected lint to run in my local repo pre-commit.

@salazarm
Copy link
Contributor

I don't think our pre-commit hook runs lint.

@anuthebananu anuthebananu force-pushed the anurag/oper-1526-add-sql-syntax-highlighting-to-dbt-asset-details-page branch from 8d283bb to 940d8ff Compare December 17, 2024 21:03
@anuthebananu anuthebananu force-pushed the 12-17-add_custom_colors_to_markdown_code_block_for_syntax_highlighting branch from 4bd9abe to f474466 Compare December 17, 2024 21:03
Copy link
Contributor Author

Ah well that would explain it then.

Per .pre-commit-config.yaml we do run ruff-format and ruff-lint to apply style and linting rules to backend/Python code, seems weird that we wouldn't also do it for js. Any reason for this?

@anuthebananu anuthebananu force-pushed the 12-17-add_custom_colors_to_markdown_code_block_for_syntax_highlighting branch from f474466 to 7ac235f Compare December 17, 2024 21:08
@salazarm
Copy link
Contributor

No reason. We could probably add it, but generally I have eslint auto-format my files on save so I don't need the pre-commit hook but I'm guessing you don't have eslint configured in vscode to do this automatically.

Copy link
Contributor

@salazarm salazarm left a comment

Choose a reason for hiding this comment

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

🥳

Copy link
Contributor Author

anuthebananu commented Dec 17, 2024

Merge activity

  • Dec 17, 4:19 PM EST: A user started a stack merge that includes this pull request via Graphite.
  • Dec 17, 4:22 PM EST: Graphite rebased this pull request as part of a merge.
  • Dec 17, 4:23 PM EST: A user merged this pull request with Graphite.

@anuthebananu anuthebananu changed the base branch from anurag/oper-1526-add-sql-syntax-highlighting-to-dbt-asset-details-page to graphite-base/26554 December 17, 2024 21:20
@anuthebananu anuthebananu changed the base branch from graphite-base/26554 to master December 17, 2024 21:20
@anuthebananu anuthebananu force-pushed the 12-17-add_custom_colors_to_markdown_code_block_for_syntax_highlighting branch from 2402f9c to 9125a5f Compare December 17, 2024 21:21
@anuthebananu anuthebananu merged commit 8b83349 into master Dec 17, 2024
0 of 2 checks passed
@anuthebananu anuthebananu deleted the 12-17-add_custom_colors_to_markdown_code_block_for_syntax_highlighting branch December 17, 2024 21:23
neilfulwiler pushed a commit that referenced this pull request Dec 19, 2024
)

## Summary & Motivation
Default syntax highlighting colors from `highlight.js` were not always clearly visible in dark mode. Adding our custom colors improves the contrast and ensures we'll always have good contrast in light and dark mode.

## How I Tested These Changes
run `dagster dev` on the sample dbt project and look at dbt asset descriptions. 

Below are screenshots of various sql code blocks from the dbt asset descriptions, illustrating the new colors in light and dark mode.

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/DyC7O5ZxCGGdPTWXzKVQ/b551ca49-bcf6-4f36-adf0-2389377b82fe.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/DyC7O5ZxCGGdPTWXzKVQ/2c545b00-d04f-4178-aa0b-f32ac139c4ca.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/DyC7O5ZxCGGdPTWXzKVQ/91bfe071-ca6d-4f15-862d-1af9ee5e0c11.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/DyC7O5ZxCGGdPTWXzKVQ/2918b815-dd8d-4317-8f62-9c643133e117.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/DyC7O5ZxCGGdPTWXzKVQ/dc19ca55-4e47-4f77-a90e-ab092aa0c1fa.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/DyC7O5ZxCGGdPTWXzKVQ/f5e48aae-177e-47b1-aab3-a79c6a986dc7.png)

## Changelog

> Insert changelog entry or delete this section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UI/UX Related to User Interface and User Experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants