简体   繁体   中英

A Javadoc comment with accented characters mixes blue and black color in its text on a Pandoc generated pdf. One without accented characters doesn't

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:

  • I put some one header-includes or not,
  • the Java code is under a citation or not,
  • in a box,
  • in a group
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:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM