登录  /  注册
有没有办法链接到 rmarkdown 中的选项卡式部分?
P粉541551230
P粉541551230 2023-12-20 18:55:04
[HTML讨论组]

我想创建一个指向 rmarkdown 文档中某个部分的内部链接,但该部分是一个选项卡,标准链接方法似乎不起作用。

标准方法是:

---
title: "Untitled"
output: html_document
---

# Section to link to

text and more 

# Next section

See [this section](#section-to-link-to)

Works!

就我而言,我想要链接到的部分是选项卡集的一部分:

---
title: "Untitled"
output: html_document
---

# Section {.tabset}

## Subsection to link to

text and more 

## Next subsection

text and more

# Next section

See [this section](#subsection-to-link-to)

Doesn't work :(

编辑:要明确的是 - 我的问题不是如何创建选项卡集,或者如何创建内部链接/锚点,而是交集:如何创建到选项卡式部分的内部链接。输出应如下所示:

我尝试了一些替代锚点方法(例如命名要链接到的部分,并在链接中使用该名称)。但没有喜悦。该链接在输出中突出显示,表明它应该可以工作,但单击后却不起作用。

我没有发现任何内容表明您无法链接选项卡式部分,因此我在这里询问是否有办法,或者只是没有办法。

谢谢!

P粉541551230
P粉541551230

全部回复(2)
P粉277464743

我刚刚遵循了这个答案。如果您想链接更大的部分(Section),您可以使用:#section

代码:

---
title: "Untitled"
output: html_document
---

# Section {.tabset}

## Subsection to link to

text and more 

## Next subsection

text and more

# Next section

See [this section](#section)

This seems to work

要链接该小节,正如您所提到的,您可以使用:[本节](#subsection-to-link-to)

代码:

---
title: "Untitled"
output: html_document
---

# Section {.tabset}

## Subsection to link to

text and more 

## Next subsection

text and more

# Next section

See [this section](#subsection-to-link-to)

This seems to work
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 技术文章
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2023 //m.sbmmt.com/ All Rights Reserved | php.cn | 湘ICP备2023035733号

登录PHP中文网,和优秀的人一起学习!
全站2000+教程免费学