Markdown 未编号部分但需要 anchor

标签 markdown r-markdown anchor

我正在处理一个 Markdown 文档,我希望其中的某些部分不编号。但我也想为这些部分创建 anchor 。这是一个例子:

# Appendix A: Methodology {-} {#methodology}

我希望附录 A 不被编号,但我仍然想使用 anchor 链接到它。

理想情况下,该解决方案适用于 LaTeX PDF 和 HTML。我已经弄清楚如何关闭编号部分的东西 for LaTeX但它不适用于 HTML。

最佳答案

如果您想为标题指定目标名称 (#...) 和类(如 .unnumbered),则必须使用单个集合大括号和正确的顺序。以下内容适用于 HTML 和 PDF 输出:

---
output:
  html_document:
    number_sections: yes
  pdf_document: default
---


# R Markdown

See the appendix on [methodology](#methodology).


# Appendix A: Methodology {#methodology -}

关于Markdown 未编号部分但需要 anchor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53378848/

相关文章:

r - 将 "Overall"组添加到facet_wrap (ggplot2)

intellij-idea - 将 Markdown JSX 语言注入(inject)添加到 IntelliJ

html - hr 元素不能用作 anchor 有什么原因吗?

php - 使用 CodeIgniter 锚定到某个部分

ruby-on-rails - 删除由markdown创建的html

javascript - 使用 JavaScript 时向 Bot Framework 添加断行

r-markdown - R Markdown 中的 TikZ

css - 使用 R Markdown 和 Hugo 格式化博客标题

r - 编织者忽略了fig.pos?

jquery - 如何选择具有指定class和rel的 anchor 标签?