Closed silverqx closed 1 year ago
Syntax highlighting is handled by a static configuration. It can’t be customized.
Also MDX analyzer uses MDX 2, which no longer supports indented code blocks. (See https://mdxjs.com/docs/what-is-mdx/#markdown)
Syntax highlighting is handled by a static configuration. It can’t be customized.
Thx for asap clarification, I understand but every static configuration could be made dynamic if needed.
Also MDX analyzer uses MDX 2, which no longer supports indented code blocks. (See https://mdxjs.com/docs/what-is-mdx/#markdown)
This is sad 😔, the mdx docs cite this as the reason:
The reason for that is so you can nicely indent your components
That is true but it also has another dimension and that is to avoid a lot of mess around code blocks, to have the documentation more clear.
If I have to choose between 4 indents without syntax highlighting or ```cpp
tags around every code block with syntax highlighting then I'm choosing 4 indents 😎.
But I totally understand why it's so, thx.
You depend on a Docusaurus-specific feature, which doesn’t work with other tools (such as this one). You can do that, but it’s not the choice I would recommend. Docusaurus is moving to MDX 2, I recommend being explicit about your code.
I recommend being explicit about your code
I'm also an advocate of being explicit but until it disturbs the clarity. I'm going to leave it 4 spaces indented until it works, if it stops working I can easily refactor it although I don't like it very much.
Currently, the docs are very well readable in the raw form, if I add the ```cpp
tags everywhere the raw docs start looking more messy.
Initial checklist
Problem
Is it possible to set a default syntax highlighting for code blocks?
I have something like this in my
Docusaurus
config:So when I have some code block in my MDX document intended by 4 spaces then I would expect automatic highlighting as the cpp code block.
But these code blocks are not correctly
cpp
highlighted in thevscode
editor. 😞Currently, if I want to have also syntax highlighting in the
vscode
editor I have to be explicit and I have to provide the```cpp
tag.Solution
Would be really helpful to be able to provide a default syntax highlighting to the
vscode-mdx
extension.Alternatives
None