像 HTML href="#myElementId" 这样的 Jekyll 标记?

Jekyll Markup like HTML href="#myElementId"?

有没有一种方法可以在博客中创建锚 post 和 link 就像对元素使用 html href 一样?

我基本上想要一个 table 的内容,在一个长博客的顶部有 links post。

已经有一个问题了,似乎没有真正的答案没有插头,需要确认:How to create a table of contents to Jekyll blog post?

Is there a way to create anchors within a blog post and link to them like one would with html hrefs to an element?

是的,对元素使用 html href。以下 html 代码:

<hr>

<h1>Table of contents:</h1>

<ul>
  <li><a href="#goto-1">Chapter 1</a><a id="toc-1"></a></li>
  <li><a href="#goto-2">Chapter 2</a><a id="toc-2"></a></li>
</ul>

<hr>

<a id="goto-1"></a>
<h1><a href="#toc-1">↑</a> Chapter 1</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>

<a id="goto-2"></a>
<h1><a href="#toc-2">↑</a> Chapter 2</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>

可以在 post 中使用以下标记生成:

---

**Table of contents:**

* [Chapter 1](#goto-1)<a id="toc-1"></a>
* [Chapter 2](#goto-2)<a id="toc-2"></a>

---

<a id="goto-1"></a>**[↑](#toc-1) Chapter 1**
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

<a id="goto-2"></a>**[↑](#toc-2) Chapter 2**
Lorem ipsum dolor sit amet, consectetur adipiscing elit.