squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
19.1k stars 3.39k forks source link

Improving C,C++, C# Code Detection #7065

Closed ValerioOniride closed 2 months ago

ValerioOniride commented 2 months ago

Context

After several attempts with the extra.css file and experimenting with different language combinations, including C#, I've concluded it's necessary to submit this request

Description

I would like to request an enhancement for the code block parsing capability, specifically to improve its recognition of key elements within C#, C++, and C code blocks. I suggest augmenting the parser to identify and classify these elements with a similar accuracy and granularity as demonstrated in the example provided in the Vsuals section."

Related links

Use Cases

Enhancing the API's code block parsing will improve code clarity for both authors and users, ensuring better communication of intended messages. This change will expedite learning and development within the community, aligning with the project's goal of providing accessible documentation and fostering collaboration.

Visuals

Screenshot 2024-04-19 113641

immagine

Before submitting

alexvoss commented 2 months ago

Hi,

the code highlighting is configurable. Which options have you tried and what did you not manage to achieve?

Please note that there is probably nothing to be done in Material for MkDocs per se. Either Pygments or Highlight.js would need to accept a change request. If you decide to contact them, please try to be more specific about what does not work for you and make sure to document what you have tried.

ValerioOniride commented 2 months ago

I haven't tried Highlight.js, im using this .yml configuration: markdown_extensions:

The issue i'm facing is that i don't like the result of the codeblock highlight, could you help me setting up highlight.js to make a test with?

alexvoss commented 2 months ago

All you need is in the documentation but since we don't have an example in our example repository yet, I just put one together. You need to change the code block to the language you want.

9.5.18-code-highlight-javascript-example.zip

squidfunk commented 2 months ago

Converting to discussion, since this is essentially a customization request.