我正在尝试添加以下标记
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
作为rmkardown HTML文档输出中<header>
之后的第一个。这对于Internet Explorer是必需的,如此MSDN article中所述。
此answer对我不起作用,因为标记是在<head>
的末尾添加的,但会被忽略。我的HTML输出中嵌入了一些脚本,该脚本是在X-UA兼容的元标记之前编写的。
有没有办法在rmarkdown中自动添加标签作为第一个?
答案 0 :(得分:0)
我也遇到了这个问题。正如人们在评论中所说,编辑rmarkdown使用的模板html文件是可行的。我复制并编辑了保存在大约“ C:\ Users \ ProfileX \ Documents \ R \ win-library \ 3.4 \ rmarkdown \ rmd \ h \ default.html”的模板(感谢@ visu-l)
您想将标签添加为<head>
中的第一个标签:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
然后保存html模板,并在YAML中指向它:
---
title: "xxx"
output:
html_document:
template: path/to/custom/template.html
---