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 syntax highlighter to code blocks in articles #167

Merged

Conversation

YuriSizov
Copy link
Contributor

This PR adds a syntax highlighter in the form of Highlight.js to the articles. Highlight.js has a benefit of having a dedicated ruleset for GDScript maintained by our contributors. The change is retroactive and affects all existing articles/news.

I picked a dark theme called Obsidian for this, but there are a lot of other options if you think that something else would fit better. I naturally lean towards dark themes for code, but there may be a reason to use a lighter theme instead.

image


The retroactivity of this PR has a side effect. All code blocks that don't require any highlighting should be marked as plaintext. If the language is not specified, Highlight.js will try to "detect" it. For example, this is Ruby to it:

image

/cc @akien-mga @Calinou

@YuriSizov YuriSizov force-pushed the codeblock-syntax-highlighting branch from d789b23 to 4a19c36 Compare August 22, 2020 15:08
@akien-mga akien-mga merged commit c5d2b3d into godotengine:master Aug 27, 2020
@akien-mga
Copy link
Member

Thanks!

@YuriSizov YuriSizov deleted the codeblock-syntax-highlighting branch September 1, 2020 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants