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

Syntax highlight code in slides and labs #56

Open
winstliu opened this issue Jan 6, 2020 · 0 comments
Open

Syntax highlight code in slides and labs #56

winstliu opened this issue Jan 6, 2020 · 0 comments

Comments

@winstliu
Copy link

winstliu commented Jan 6, 2020

Right now we syntax highlight all source files using source-highlight.

It would be nice to also syntax highlight all the code in the slides and labs. Would reduce eyestrain, especially for the labs.

The good news is that this can be done already:

  • pandoc supports named code blocks, so all we need to do is add cpp to all our code blocks.
  • reveal.js has
    { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
    . It's broken currently, but can be fixed by just adding reveal.js/ in front.

Ideally, the highlighting would be consistent across all sources. The labs will most likely stay in light mode, and probably the source files as well, but the slides are dark mode. That doesn't mean we can't have consistent highlighting, though, as many themes have both light and dark variants.

So all we need to do is find a theme! I personally have a soft spot for One Dark and One Light, having worked on Atom as they were being developed (they also have corresponding Emacs variants), but I understand that this really isn't a decision for me to make 😁.

Notes:

  • Pandoc does not use CSS for its theming, which is...slightly annoying. I should be able to figure out the CSS --> JSON conversion required, though, or just manually override the colors with CSS anyway after they've been generated.
  • source-highlight takes in the --style-css-file argument.
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

1 participant