我正在尝试添加以下标签
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
as the first一后<header>
在 rmkardown HTML 文档的输出中。这对于 Internet Explorer 是必需的,如本 MSDN 中所述article https://msdn.microsoft.com/library/jj676915(v=vs.85).aspx.
This answer https://stackoverflow.com/questions/43329230/r-markdown-add-tag-to-head-of-html-output对我不起作用,因为标签添加在末尾<head>
并被忽略。我的 HTML 输出嵌入了一些在 X-UA-Compatible 元标记之前编写的脚本。
有没有办法在 rmarkdown 中自动将标签添加为第一个标签?
我也刚刚遇到这个问题。正如人们在评论中所说,编辑 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
---
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)