# 无法深度链接到文本中的锚点

**URL:** https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393
**Category:** Support
**Created:** [2021年十二月17日 02:12 UTC](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393 "2021-12-17T02:12:04Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![prostasia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prostasia/32/147385_2.png) [@prostasia](https://meta.discourse.org/u/prostasia)
#### Post date: [2021年十二月17日 02:12 UTC](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/1 "2021-12-17T02:12:04Z")

</div>

我已按照此页面上的说明操作，以便直接链接到帖子中的标题，包括使用特殊的 `heading--` 格式进行链接，例如 heading–h.pv1t5s7p1t7x：

> [@Linking to a heading within a post or topic](https://meta.discourse.org/t/deep-linking-to-headings-anchors/47552):
>
> bookmark This guide explains how to link directly to a heading within a Discourse post or topic, enabling users to navigate long posts efficiently. person_raising_hand Required user level: All users Adding headings within long posts can make the content more readable and allow users to link directly to specific sections. This can be particularly useful for navigating extensive discussions and documentation. Summary This guide covers: Creating headings using Markdown Linking directly …

但是，它不起作用：

> **[Prostasia Foundation role documentation](https://forum.prostasia.org/t/prostasia-foundation-role-documentation/2350#heading--h.pv1t5s7p1t7x)**
>
> 🟢 indicates a role for which a position is available. 🔴 indicates a role that is filled or for which we are not currently recruiting. Last updated: February 19, 2024. Leadership 1.1. Board of Directors 1.1.1. Executive Director 🔴 1.1.2....

有什么建议吗？谢谢！

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2021年十二月17日 07:25 UTC](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/2 "2021-12-17T07:25:12Z")

</div>

我将此用作手动锚点代码：

`<a>`（用于帖子内）

`https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/2#header-name`（如果您想在主题外部使用链接）

例如 - [Cannot deep link to anchor in text - #2 by JammyDodger](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/2#header-name)

还有一个 DiscoTOC 主题组件可能值得一看？

> [@DiscoTOC - automatic table of contents](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143):
>
> discourse2Summary DiscoTOC will allow you to generate an interactive table of contents for your topics with one click!eyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/discotoc)hammer_and_wrenchRepository Link [https://github.com/discourse/DiscoTOC](https://github.com/discourse/DiscoTOC)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Samples Desktop Mobile Features toc = table of contents Automatically generates the …

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2021年十二月17日 07:49 UTC](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/3 "2021-12-17T07:49:14Z")

</div>

您也可以尝试使用自动标题锚点功能

```plaintext
# headline1
### headline3
##### headline5

```

# headline1

### headline3

##### headline5

[链接到headline1](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/3#headline1-1) `https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/3#headline1-1`

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2021年十二月17日 07:54 UTC](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/4 "2021-12-17T07:54:00Z")

</div>

太好了。👍 我被骗了，以为它们不再起作用了，因为我无法通过点击其中一个来抓取标题链接。🙂

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2021年十二月17日 07:56 UTC](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/5 "2021-12-17T07:56:57Z")

</div>

您需要点击标题前的空白处。

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2021年十二月17日 08:03 UTC](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/6 "2021-12-17T08:03:37Z")

</div>

我以前点击标题时，左侧会出现一个链接图标，我可以从中获取链接，但现在不再这样了。 ~~点击间隙似乎不起作用？~~

**编辑：** 我太快下结论了。🙂 我现在明白了。长按间隙可以完成工作。👍 我当时在等链接图标出现。谢谢。🙂

我唯一觉得自动编号有问题的是，如果之后添加另一个标题，现有的链接中的标题编号就会出错，所以如果文档容易添加/删除内容，就需要小心。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2022年一月16日 08:03 UTC](https://meta.discourse.org/t/cannot-deep-link-to-anchor-in-text/212393/7 "2022-01-16T08:03:41Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
