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

custom highlighting-style conflicts with --listings #209

Closed
sfc-gh-kcox opened this issue Nov 24, 2020 · 1 comment
Closed

custom highlighting-style conflicts with --listings #209

sfc-gh-kcox opened this issue Nov 24, 2020 · 1 comment
Labels

Comments

@sfc-gh-kcox
Copy link

I am using a custom highlight-style and syntax-definition template for my Markdown files. Everything is stored in a Docker container which I then run as follows:

docker run --volume $BASEDIR:/data \
  --user `id -u`:`id -g` edu_pandoc \
    --template=/data/templates/eisvogel.tex \
    --filter=pandoc-include-code \
    --filter=pandoc-latex-environment \
    --highlight-style=/data/templates/sql.theme \
    --syntax-definition=/data/templates/sql.xml \
    --number-sections \
    --toc-depth=2 \
    --metadata=date:$3 \
    $LIST_OF_MD \
    -o output/$1_$2_workbook_$3.pdf

My problem is that periodically I need to add longer stretches of inline code that uses backticks to highlight the text background. Anything longer than 4-5 words does not wrap.

My solution to this was to enable --listings in the pandoc execution. This solved the wrapping issue, but then all other words of phrases that were previously highlighted using single backticks no longer had a gray background.

Is it possible to use --listings in conjunction with custom highlight-style and syntax-definition formats? The former cancels out the two latter versions.

Apologies if this is not the correct forum.

@Wandmalfarbe
Copy link
Owner

Wandmalfarbe commented Dec 13, 2020

My problem is that periodically I need to add longer stretches of inline code that uses backticks to highlight the text background. Anything longer than 4-5 words does not wrap.

This is a known pandoc problem (see jgm/pandoc#4302) that I tried to solve for Eisvogel (see #2) but the changes don't work as expected (see #176).

My solution to this was to enable --listings in the pandoc execution. This solved the wrapping issue, but then all other words of phrases that were previously highlighted using single backticks no longer had a gray background.

This is also a known issue (see #42).

Is it possible to use --listings in conjunction with custom highlight-style and syntax-definition formats?

This is not possible because these options work with the default pandoc built-in highlighting which is done by skylighting. When using --listings everything like tokenization, coloring, formatting and such is done by the listings package. Listings has very limited options regarding syntax definitions. I've included an example definition in Eisvogel for Java. But the listings syntax highlighting will always be inferior to the pandoc built-in highlighting.

You could work around this by using the minted package for highligting. Please keep in mind that the setup might be a little more work than just specifying a command line option. Unfortunately pandoc has no native support for syntax highlighting with minted (see jgm/pandoc#4117). There is however a pandoc supported filter to use minted for syntax highlighting (see https://github.com/pandoc/lua-filters/tree/master/minted).

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

No branches or pull requests

2 participants