Iacchus
Iacchus

Reputation: 2837

Disable Syntax Highlight in Sphinx (Alabaster theme)

How to disable syntax highlight in Sphinx?

I've tried setting highlight language to 'none' and setting ..language:: none.

Also tried setting it to 'text'.

I tried removing the html and make clean. But the syntax highlighting is there. (using Alabaster theme)

conf.py is configured with these extensions:

extensions = ['sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages',
    'numpydoc',
    ]

EDIT: Well it seems that viewcode extension is doing this and that it is quite hard coded

Upvotes: 1

Views: 711

Answers (2)

Iacchus
Iacchus

Reputation: 2837

This was fixed.. fixed in 1.6-release

Upvotes: 0

Steve Piercy
Steve Piercy

Reputation: 15055

viewcode applies syntax highlighting only to Python source files. To disable highlighting in just those files, you could edit the source of the file by modifying this line in the lexer logic adding , 'none'.

    if env.config.highlight_language in ('python3', 'default', 'none'):

It looks like you already submitted a PR for it.

For all other files rendered by Sphinx in your narrative documentation, you can disable highlighting globally in conf.py:

highlight_language ='none'

Then this would be inherited by your modification in viewcode.

Upvotes: 2

Related Questions