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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable syntax highlighting languages #1879

Closed
bravo-kernel opened this issue Oct 24, 2019 · 3 comments 路 Fixed by #2250
Closed

Configurable syntax highlighting languages #1879

bravo-kernel opened this issue Oct 24, 2019 · 3 comments 路 Fixed by #2250
Labels
proposal This issue is a proposal, usually non-trivial change

Comments

@bravo-kernel
Copy link
Contributor

bravo-kernel commented Oct 24, 2019

I am creating this ticket for v2 after discussing with @endiliey to start the discussion (ping @langpavel).

馃殌 Feature

Extend docusaurus.config.js so users can easily add/remove prismjs syntax highlighting languages.

Motivation

Currently:

  • docusaurus ships with a hard-coded set of 32 languages (out of 192) enforced by prism-react-renderer
  • the solution makes it hard to add additional languages, see:
    • install prismjs package
    • swizzle CodeBlock component
    • update code as described in these docs

Pitch

Should be implemented so that:

  • Docusaurus can be used for documenting all-the-things
  • the Docusaurus project can control the list of default languages, possibly even decreasing the default bundle size

Pre-discussed

The solution could be something like:

  • add prismjs to package.json
  • only add languages that are present in the configuration file to the build/bundle
  • because the CodeBlock component already falls back to "plain" if the language is not available, possibly no changes needed there
@endiliey endiliey added the 2.x label Oct 25, 2019
@endiliey endiliey added the proposal This issue is a proposal, usually non-trivial change label Nov 20, 2019
@bravo-kernel
Copy link
Contributor Author

Closing this request based on received feedback; will not be implemented as swizzling the code block is a proper alternative.

@bravo-kernel
Copy link
Contributor Author

Wow, I had no idea this was being worked on. Amazing surprise 馃帀

@yangshun
Copy link
Contributor

yangshun commented Mar 8, 2020

All thanks to @lex111 who does all the amazing work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal This issue is a proposal, usually non-trivial change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@bravo-kernel @yangshun @lex111 @endiliey and others