Pandoc 2.0.5
Currently, when building standalone html docs that use syntax highlighting, pandoc will always enforce a CSS style — if no style is specified via --highlight-style, pandoc will use the default pygments style.
It would be useful to be able to tell pandoc not to produce any style, with something like --highlight-style=none. I often use a custom CSS file (via --css option) that also covers the definitions for syntax highlighted code, and having the default style CSS in the document complicates things, beside being unnecessary.
Currently, I'm using one of these two workarounds to prevent pandoc injecting the default style into the html doc:
Use a modified html template from which I remove:
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
</style>
$endif$
Invoke pandoc with the -V highlighting-css: option, which will make the template fail the $if(highlighting-css)$ check.
IMO, having a way to explicitly specify not to use any style via a none value for --highlight-style would be better.
You can always use a custom template, removing the variable that gets replaced by highlighting definitions. Still, the =none option might be a good idea.
Also, I'm curious what sorts of style customizations you're doing that can't be handled with a json style theme.
Also, I'm curious what sorts of style customizations you're doing that can't be handled with a json style theme.
I'm using a different color scheme for each language in the document. Whenever possible, I use a language's default IDE's standard color theme (if there is one). This allows to quickly to reckognize code blocks in very long documents, and adds a sense of familiriaty to code. In some cases, like diff logs, using a separate style/theme altogether is more than just aesthetics because a shared style will fail to renderer a colored diff (eg:, like the one showed on GitHub website) in a familiar way.
Using bigger CSS stylesheets is no longer a problem, unlike the early days of the WWW. Today we are free to add all the styles we want without fear of documents taking too long to load over the Internet.
One problem with =none is LaTeX output. We'd get a compile failure from missing macro definitions, rather than just having things look unhighlighted. Of course you could say it's the user's responsibility to provide these, but people might have different impressions about what =none does.
Preserving integrity of all formats is definitely a higher priority (I mainly work with html and markdown format only).
Maybe instead of using the value none, another option could be introduced (eg: --no-styles, along the lines of --no-highlight) that could be specific to some formats only (html related, and other formats which don't break down if no styles are present).
I've got an easy solution for you (HTML). It works already:
-Vhighlighting-css=""
Could we also have yaml metadata block
---
highlight: false
---
equivalent to pandoc --no-highlight?
Somewhat related: As far as I can tell, right now there is no defaults file entry that is equivalent to --no-highlight.
@allefeld if not that's an oversight, but it should be requested in a new issue
Most helpful comment
Could we also have
yamlmetadata blockequivalent to
pandoc --no-highlight?