Why do I have mixed colors in Javadoc comments when using accented characters?
This markdown:
/** Première manière **/
@GetMapping
public String index() {
return "Hello Spring Boot";
}
/** Deuxième manière */
@RequestMapping("/")
public String greetings() {
return "Greetings";
}
produces this on a pdf, with Pandoc:
Blue and black colors are mixed in the middle of the text comment. Each time it encounters an accented character, here: è
.
But without accented characters, it produces that:
Here, it's more correct, but I wonder why the whole Javadoc comment isn't blue?
my header-includes
are these ones, but I have the same behavior whatever:
one header-includes
or not,header-includes:
- \usepackage{tcolorbox}
- \usepackage{fvextra}
- \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,breakanywhere,breaksymbol=,breakanywheresymbolpre=,commandchars=\\\{\}}
Is there a way to correct the behavior with accented characters? It doesn't have a nice effect.
@abra If I change è
with è
, é
with é
and all the characters here it produces this:
The issue is not specific to PDF, it also happens when converting to HTML:
pandoc -s test.md -o test.html
For syntax highlighting, pandoc uses KDE XML syntax definition files. The one for Java is here.
Download it and open it in a text editor. You will find this at line 3777:
<!-- Comment next line if you don't use Javadoc tool -->
<IncludeRules context="##Javadoc"/>
Do as indicated in the comment:
<!-- Comment next line if you don't use Javadoc tool -->
<!--IncludeRules context="##Javadoc"/-->
Now convert with your custom syntax definition file:
pandoc --syntax-definition=java.xml -s test.md -o test.html
Here is the result: