highlight.js vs CodeHilite & Pygments
See original GitHub issueDescription
Why bothering with CodeHilite and Pygments when mkdocs officialy and natively supports the much better highlight.js?
See https://www.mkdocs.org/user-guide/styling-your-docs/#mkdocs
Expected behavior
Syntax highlight works out of the box thanks to highlight.js
Actual behavior
Syntax highlight is not working because it requires CodeHilite marodwn extension to be enabled and Pygments python dependency to be installed.
See https://squidfunk.github.io/mkdocs-material/extensions/codehilite
Steps to reproduce the bug
Not relevant.
Package versions
- Python:
python --version:Python 3.7.3 - MkDocs:
mkdocs --version:mkdocs, version 1.0.4 from /usr/lib/python3.7/site-packages/mkdocs (Python 3.7) - Material:
pip show mkdocs-material | grep -E ^Version:Version: 4.4.0
Project configuration
Not relevant.
System information
- OS: ArchLinux
- Browser: Firefox
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
CodeHilite — Python-Markdown 3.4.1 documentation
The CodeHilite extension adds code/syntax highlighting to standard Python-Markdown code blocks using Pygments. This extension is included in the standard ...
Read more >Python-Markdown/markdown/extensions/codehilite.py
codehilite.py ... Determine language of source code, and pass it on to the Pygments ... just escape and build markup usable by JS...
Read more >Syntax Highlighting | Hugo
Highlighting is carried out via the built-in highlight shortcode. It takes exactly one required parameter for the programming language to be highlighted and ......
Read more >Code blocks - HPC & AI cluster
Default: true – This option allows to control whether highlighting should be carried out during build time by Pygments or runtime with a...
Read more >extensions/codehilite.py · hemamaps/Markdown - Gemfury
Learn more » Push, build, and install RubyGems npm packages Python ... try: from pygments import highlight from pygments.lexers import get_lexer_by_name, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

FYI, previous discussion on this: https://github.com/squidfunk/mkdocs-material/issues/1004.
This is a subjective statement. This is simply a matter of preference.
The official mkdocs theme official supports it. Mkdocs itself doesn’t particularly care what you use.
Highlight.js will pick up on language declarations assuming assume they are specified, which would require you to use CodeHilite even if you don’t want to use Pygments. Unless you really only on highlight.js guessing, which can be hit or miss.
It’s not too hard to configure CodeHilite to not use Pygments and then include highlight.js via the Mkdocs
extra_jsoption.Ultimately, it is the theme’s choice what to support our of the box. But there is nothing stopping people from using highlight.js.