Jekyll页面内的链接 [英] Jekyll link within page
问题描述
我在Github上使用Jekyll,并且我想知道是否有链接到页面内部分的方法。假设我有一个部分,如
##第1部分##
部分内容
以及稍后在同一页面中我想链接到此部分。我发现如何链接到博客中的其他页面和脚注,但不是这个。
注意,我在 _config.yml
中使用 markdown:kramdown
如果设置了
auto_ids选项,kramdown支持自动生成标题ID为true(这是默认值)。这是通过
转换未转换的,即简单的标题文本来完成的。因此,在上面的例子中,
$ > ## Section 1 ## ,它会生成以下id:id =section-1
,然后锚点通过via A元素:
< A href =#section-1>第一部分< / A>
或者在普通的kramdown / markdown中:
[Section 1] 1)
I'm using Jekyll on Github, and I wonder whether there's a way to link to a section within a page. Say I have a section like
## Section 1 ## section content
and later in the same page I want to link to this section. I've found how to link to another page within the blog and do footnotes, but not this.
As a note, I use
markdown: kramdown
in my_config.yml
解决方案kramdown supports the automatic generation of header IDs if the option auto_ids is set to true (which is the default). This is done by converting the untransformed, i.e. plain, header text
So in the above example
## Section 1 ##
, it would generate the following id:id="section-1"
, then the anchor is linked to via the A element:<A href="#section-1">Section One</A>
Or in plain kramdown/markdown:
[Section 1](#section-1)
这篇关于Jekyll页面内的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!