由于某些原因(我不知道),它在pandoc.R中被硬编码。我尝试在YAML部分中指定html5:
---
title: "My title"
date: "`r Sys.time()`"
output:
html_document:
fig_width: 8
fig_height: 6
toc: true
theme: null
mathjax: null
highlight: "pygments"
md_extensions: -autolink_bare_uris
self_contained: FALSE
template: journal.html5
pandoc_args: ["--to=html"]
---
但是当我渲染它时(通过rmarkdown::render("file.rmd")
,我不使用RStudio),控制台输出如下:
/usr/bin/pandoc +RTS -K512m -RTS table_to_graph.utf8.md --to html4 --from
markdown+tex_math_single_backslash-autolink_bare_uris+smart --output file.html
--email-obfuscation none --to=html --standalone --section-divs --table-of-contents
--toc-depth 3 --template journal.html5
--highlight-style pygments --lua-filter
您可以看到两个参数。目标是只拥有--to html
。当我将-t html
放入YAML时,出现错误:
Unknown writer: html
Error: pandoc document conversion failed with error 1
在pandoc manual中有变体--to=html
和-t html
。
因此,现在我必须在每个rmarkdown更新中手动修补pandoc.R
文件(经常)。如果有人知道如何通过YAML强制html(5),请回答。
更新:pandoc信息
$ pandoc -v
pandoc 2.7.3
Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.8.1
Default user data directory: /home/***/.local/share/pandoc or /home/***/.pandoc
Copyright (C) 2006-2019 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
$ eix -I pandoc
[I] app-text/pandoc-bin [1]
Доступные версии: 2.6^m 2.7.3^p
Установленные версии: 2.7.3^p(10:40:08 13.11.2019)
Домашняя страница: https://pandoc.org https://github.com/jgm/pandoc
Описание: An universal document converter
[1] "local_overlay" /usr/local/portage