The problem
According to the docs, Xaringan should
turn normal quotes
" "
into smart quotes “ ”, andturn a sequence of 3 hyphens "
---
" into an em-dash "—"
The problem I have is that these transformations only occur for the strings in the yaml metadata (which appear in the title slide), but not for the text in the normal slides.
Example
File minimal.Rmd
contains the following code:
---
title: "\"It works, doesn't it?\" --- this is the title slide"
subtitle: "Smart quotes and em dash work in yaml"
output:
xaringan::moon_reader
---
# This is a normal slide
It works in the slides too, doesn't it? --- "I hope so", he said.
No, it doesn't.
After knitting, I get the following slides in minimal.html
:
Ideas
I am pretty sure Xaringan does not use Pandoc to generate the html. If Pandoc were used in the process, it would beautify the quotes by default.
I tried using
smart: true
in the yaml metadata as shown in the RMarkdown book, but it has no effect.Looking at the code for the
moon_reader
function, I see it callsrmarkdown::html_document
to generate the html.This open issue in the
RMarkdown
Github repository discusses thesmart: true
option and the equivalent option in the call to Pandoc. The author of the issue suggests to drop the yaml option and leave it up to Pandoc to beautify the quotes etc.But Xaringan does not use Pandoc, so could this be relevant?
My setup
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS
xaringan_0.15
knitr_1.28
rmarkdown_2.1
Thanks in advance for your help.