Skip to content
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

Better JavaScript syntax highlighting #441

Closed
TimKam opened this issue Jul 17, 2017 · 8 comments
Closed

Better JavaScript syntax highlighting #441

TimKam opened this issue Jul 17, 2017 · 8 comments

Comments

@TimKam
Copy link

TimKam commented Jul 17, 2017

The Sphinx Read the Docs theme could do better in highlighting JavaScript code:
js_syntax_highlighting

Sphinx/Pygments already provides the necessary classes:
classes_highlight

So this should be merely a matter of adding additional styles.

If this makes sense to you, I could try to find the time for creating a PR.

@Blendify
Copy link
Member

PRs are welcome anytime.

@ericholscher
Copy link
Member

Yep, this would be a great addition!

TimKam added a commit to TimKam/sphinx_rtd_theme that referenced this issue Jul 27, 2017
@ghost
Copy link

ghost commented Sep 5, 2017

@TimKam What Atom UI/Syntax do you use?

@Blendify
Copy link
Member

Blendify commented Sep 5, 2017

#448 should fix this.

@skaller
Copy link

skaller commented Nov 25, 2017

Could I have some feedback on this please? In my case, it isn't JS that's the problem, but other Pygments lexers. With "classic" html_theme the colours are strong, the bolding good, and the sizes slightly bigger, and the background different from RTD. I don't mind the size change or background difference much, but the Pygments colours are basically clobbered.

The bolding is unnoticeable and almost all the colour is bled away, except the disgusting bright red used for string literals.

This is running the online version of RTD. Shouldn't the theme respect the Pygments colours?

The problem I have is that the tokenisation scheme used doesn't really fit my language or what I want to see, so I have to fudge a bit to get the appearance right, but nothing works on RTD.

My language (Felix) isn't the only one impacted. C++ code is similarly impacted. Comments get faded to almost unreadable status, colour is bled away.

@Blendify
Copy link
Member

The reason this does not work is that the HTML is not aware of the Pygments CSS #448 was going to fix this but this change is now included in a larger set of changes that can be found in this PR: #467. There are two temp fixes:

  1. Use pip install git+https://github.com/rtfd/sphinx_rtd_theme.git@6da7eb974754582353e80eada1151751745e185c

  2. Add http://www.sphinx-doc.org/en/stable/extdev/appapi.html#sphinx.application.Sphinx.add_stylesheet to the conf.py to link the css file manually.

@skaller
Copy link

skaller commented Nov 25, 2017

Ok thanks!

actually I used a a <style> tag in a _template/layout.html and that seemed to work. The template gets injected after the main css is linked so it overrides it.

@Blendify
Copy link
Member

Basic support for this has been added and #504 finishes this up. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants