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

enhance(syntax-highlight): enable Go language, set tab-size to 4 #11608

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

bsmth
Copy link
Member

@bsmth bsmth commented Aug 8, 2024

Summary

There's some Go code landing in some pages and blog posts soon.

Problem

We don't support Go lang syntax highlighting.

Solution

Enable go in Prism and add tab-size: 4 style to make gofmt-formatted code look nicer than default 8char width.

Screenshots

Before:

image

With go syntax highlighting:

image

With go syntax highlighting and tab-size: 4:

image

How did you test this change?

  • yarn && yarn dev
  • localhost:3000

@bsmth bsmth requested a review from a team as a code owner August 8, 2024 10:10
@@ -450,6 +450,7 @@ code,
border-radius: var(--elem-radius);
font-family: var(--font-code);
font-size: var(--type-smaller-font-size);
tab-size: 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I right to assume we don't use tabs in code samples for other languages, so this shouldn't affect any existing code samples?

Copy link
Member Author

Choose a reason for hiding this comment

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

I could only find one occurrence here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#using_the_space_parameter

using:

grep -ri --binary-files=without-match --exclude="./files/en-us/_redirects.txt" " " ./files

@caugner caugner changed the title feat: enable Go language syntax highlighting, set pre,code tab-size to 4 enhance(syntax-highlight): enable Go language, set tab-size to 4 Aug 9, 2024
@bsmth
Copy link
Member Author

bsmth commented Aug 26, 2024

Thanks, Claas, merging now 👍🏻

@bsmth bsmth merged commit 61db1a6 into mdn:main Aug 26, 2024
10 checks passed
@bsmth bsmth deleted the prism-go branch August 26, 2024 08:45
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