Internal links in rmarkdown don't work

前端 未结 5 950
夕颜
夕颜 2020-12-14 16:13

I use rmarkdown to render pdf documents. Now I want to add internal links in the texts.

In the helping pages of rmarkdown, it says an internal link is defined as:

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 17:12

    There are some tricky rules for internal links in Rmarkdown PDF output, not well documented on cheat sheets, etc.

    Rules:

    • Only one # for anchor, even if you are using a header with multiple #.

      Example: ###header becomes #header when linking.

    • No spaces between # and anchor text.

      Example: #header, not # header.

    • Multi-word anchors should be separated by dashes.

      Example: #this is a header needs to become #this-is-a-header in the link.

    • Anchor links need to be lowercase, even if the header you are linking to has capitalization.

      Example: #Section becomes #section in the link.

提交回复
热议问题