Mkdocs-material: Missing syntax highlighting for code blocks

Created on 4 Aug 2017  路  4Comments  路  Source: squidfunk/mkdocs-material

Description

There is no syntax highlighting in code blocks.

Expected behavior

I expect markdown code blocks to have syntax highlighting (like the default mkdocs theme does).

Example markdown code block:

``` javascript
function add(a, b) {
    return a + b
}

Syntax highlighting in default mkdocs theme:

mkdocs-default

Actual behavior

If I use this mkdocs theme there is no syntax highlighting in code blocks:

mkdocs-material

Steps to reproduce the bug

  1. Add a code block to your markdown file
  2. Install the latest version of Material with pip: pip install mkdocs-material
  3. Add the following line to mkdocs.yml: theme: 'material'
  4. Run the built-in dev-server: mkdocs serve
  5. Open up http://127.0.0.1:8000/ in the browser

Package versions

  • Python: 3.6.1
  • MkDocs: 0.16.3
  • Material: 1.8.0

Project configuration

site_name: Code Demo
theme: material

System information

  • OS: Windows 10 1703

Most helpful comment

Did you install Pygments and activate CodeHilite extension in your theme?

http://squidfunk.github.io/mkdocs-material/extensions/codehilite/

All 4 comments

Did you install Pygments and activate CodeHilite extension in your theme?

http://squidfunk.github.io/mkdocs-material/extensions/codehilite/

The thing is: if you install mkdocs-material via pip, it SHOULD install Pygments for you, as it is specified as a dependency. Please check if Pygments is/was installed. If not, we can look into it.

Yes Pygments was installed with mkdocs-material. I just forgot to add

markdown_extensions:
  - codehilite

to my mkdocs.yml. Sorry for that & Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yogeshbeniwal picture yogeshbeniwal  路  4Comments

yannduran picture yannduran  路  4Comments

dbdevtop picture dbdevtop  路  4Comments

nikramakrishnan picture nikramakrishnan  路  3Comments

lupupitkanen picture lupupitkanen  路  4Comments