New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choosing pygments monokai style #166

Closed
lifeBalance opened this Issue Jan 24, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@lifeBalance

lifeBalance commented Jan 24, 2015

Following the instructions given in the sphinx docs, in my conf.py I set:

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'monokai'

But it doesn't work. Any ideas why? Thanks.

@patricksnape

This comment has been minimized.

Show comment
Hide comment
@patricksnape

patricksnape Jan 30, 2015

Can confirm that this doesn't work (Sphinx==1.3b2, sphinx-rtd-theme==0.1.6, Pygments==2.0.2) using the Napolean extension, on Ubuntu 14.04 x64.

patricksnape commented Jan 30, 2015

Can confirm that this doesn't work (Sphinx==1.3b2, sphinx-rtd-theme==0.1.6, Pygments==2.0.2) using the Napolean extension, on Ubuntu 14.04 x64.

@frol

This comment has been minimized.

Show comment
Hide comment

frol commented Feb 3, 2015

@lifeBalance

This comment has been minimized.

Show comment
Hide comment
@lifeBalance

lifeBalance Feb 6, 2015

Thanks frol. But I don't get it. How can I change the pygments style?

lifeBalance commented Feb 6, 2015

Thanks frol. But I don't get it. How can I change the pygments style?

@frol

This comment has been minimized.

Show comment
Hide comment
@frol

frol Feb 6, 2015

@lifeBalance While it has to be fixed in RTD theme, there is a workaround.
Create source/_templates/layout.html tempate with the following content:

{# layout.html #}
{# Import the theme's layout. #}
{% extends "!layout.html" %}

{% set css_files = css_files + ['_static/pygments.css'] %}

Then your pygments_style variable in the conf.py will take effect.

frol commented Feb 6, 2015

@lifeBalance While it has to be fixed in RTD theme, there is a workaround.
Create source/_templates/layout.html tempate with the following content:

{# layout.html #}
{# Import the theme's layout. #}
{% extends "!layout.html" %}

{% set css_files = css_files + ['_static/pygments.css'] %}

Then your pygments_style variable in the conf.py will take effect.

Robpol86 added a commit to Robpol86/terminaltables that referenced this issue Jun 11, 2016

Better syntax highlighting.
Adding section about documentation to CONTRIBUTING.md.

Changing syntax highlighting theme to something that supports pycon.
Thanks to rtfd/sphinx_rtd_theme#166

asrulhadi added a commit to asrulhadi/template that referenced this issue Sep 16, 2016

Add the link to pygments.css
Make sure monokai style can be used by explicitly include pygments.css
Ref: rtfd/sphinx_rtd_theme#166
@oliver-sanders

This comment has been minimized.

Show comment
Hide comment
@oliver-sanders

oliver-sanders Jul 17, 2017

Note that the workaround #166 (comment) results in a mixed style. Attributes like font weight / style will likely leak from the RTD style into the pygments style.

A not-so-nice workaround:

_templates/layout.html

{% extends "!layout.html" %}

{% set css_files = css_files + ['_static/css/reset-syntax.css', '_static/pygments.css'] %}

_static/css/reset-syntax.css

.highlight * {
    color: black;
    font-weight: normal;
    font-style: normal;
    background-color: transparent;
}

oliver-sanders commented Jul 17, 2017

Note that the workaround #166 (comment) results in a mixed style. Attributes like font weight / style will likely leak from the RTD style into the pygments style.

A not-so-nice workaround:

_templates/layout.html

{% extends "!layout.html" %}

{% set css_files = css_files + ['_static/css/reset-syntax.css', '_static/pygments.css'] %}

_static/css/reset-syntax.css

.highlight * {
    color: black;
    font-weight: normal;
    font-style: normal;
    background-color: transparent;
}

ericholscher added a commit that referenced this issue Dec 3, 2017

Merge pull request #448 from rtfd/fix-pygments
Fix #166: Add missing pygments css link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment