gpt4 book ai didi

r - 在 rmarkdown html 输出中添加 X-UA-Compatible

转载 作者:行者123 更新时间:2023-12-02 11:17:07 24 4
gpt4 key购买 nike

我正在尝试添加以下标签

 <meta http-equiv="X-UA-Compatible" content="IE=edge" />

作为 <header> 之后的第一个在 rmkardown HTML 文档的输出中。这对于 Internet Explorer 是必需的,如 MSDN article 中所述。 。

这个answer对我不起作用,因为标签添加在 <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
---

关于r - 在 rmarkdown html 输出中添加 X-UA-Compatible,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44009148/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com