5
votes

When German quotation marks („ and “ or HTML code „ and “, see https://unicode-table.com/de/201E/ and https://unicode-table.com/de/201C/) are in between bold text markers **...**, then pandoc does not render the text bold when I knit in RStudio. Even worse, the **s are printed verbatim in the HTML document.

Example:

---
output: html_document
lang: de
---

This is a **„Test“**.

Another **„Test“**.

This **"just works"**.

Result:

German quotation marks break the bold text

Are there any pandoc options or workarounds for solving this problem?

Note that a similar question was answered for PDF output in r-markdown: German quotation marks. But I need HTML output.

2

2 Answers

4
votes

The issue tracking input of localized quotes is https://github.com/jgm/pandoc/issues/661.

Meanwhile, I recommend using non-typographic quotes (") and for HTML-output use the --html-q-tags option and some CSS, like:

q {
  quotes: '„' '“';
}
0
votes

My workaround: I made use of the command line tool sed and regular expressions:

First, modify the .Rmd (or .md) file and replace all the German typographic quotation marks with standard quotation marks: (WARNING: commands change the file inplace!)

sed -i 's/„/"/g' mydocument.Rmd
sed -i 's/“/"/g' mydocument.Rmd

Knit the document (or convert it to HTML with pandoc).

Then, replace all the English typographic quotation marks with German ones:

sed -i "s/“/„/g" mydocument.html
sed -i "s/”/“/g" mydocument.html