Github Markdown同一页链接

Ale*_*ggs 69 markdown github

假设我在同一个git hub wiki页面中有两个点,为此我们将调用place 1place 2.

##Title

###Place 1

Hello, this is some text to fill in this, [here](place2), is a link to the second place.

###Place 2

Place one has the fun times of linking here, but I can also link back [here](place1).
Run Code Online (Sandbox Code Playgroud)

另一种选择是ToC.

##Title
[ToC]
###Place 1
###Place 2
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?注意 - 看到这个,所以我会假设它是关于主题的.此外,它处理文件之间的转换,这个处理在同一文件之间进行.

blu*_*Cat 79

这篇关于Github的工作:

## Title

### Place 1

Hello, this is some text to fill in this, [here](#place-2), is a link to the second place.

### Place 2

Place one has the fun times of linking here, but I can also link back [here](#place-1).
Run Code Online (Sandbox Code Playgroud)

转换规则摘要:

  • 标点符号将被删除
  • 领先的白色空间将被丢弃
  • 大写将转换为更低
  • 字母之间的空格将转换为 -

LivingSocial API设计指南是一个包含大量链接和格式的好示例文档

  • 请注意,参考链接本身必须编码为小写。使用上面的示例,如果您链​​接到`[here](#Place-2)`,则该链接将不起作用。请注意,在示例中,标题被称为“Place 2”,而指向它的链接(正确地)被称为“[here](#place-2)”。 (3认同)
  • 如果你有两个或多个标题为"Place"的标题,则链接将命名为"place","place-1","place-2"等.然后,如果你还有一个明确的标题`Place 2`,链接将是`place-2-1`. (3认同)

bca*_*tle 19

如果您有一堆具有相同名称的(子)标题,也可以创建命名自定义锚点.要使用标头插入HTML标记:

<h4 id="login-optional-fields">
Optional Fields
</h4>
Run Code Online (Sandbox Code Playgroud)

然后通过ID属性链接到它:

[see above](#login-optional-fields)
Run Code Online (Sandbox Code Playgroud)

还可以将锚标记直接添加到文档中:

<a id="my-anchor"></a>
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,此解决方案有效,原因之一。去年对GIT markdown的更改阻止了将标题添加为“ #my heading”,而必须将其添加为“#my heading”,并在锚点中添加了一个空格,如((#my-heading)`不起作用 (2认同)

Ela*_*Tal 7

复制自 GitHub Gist - 原始帖子位于此处

要创建跳转到自述文件不同部分的锚链接(如交互式目录),首先创建一个标题:

#Real Cool Heading
Run Code Online (Sandbox Code Playgroud)

该标题的锚链接是小写标题名称,其中有空格,带有破折号。您始终可以通过访问 Github.com 上的自述文件并单击将鼠标悬停在标题左侧时出现的锚点来获取锚点名称。复制从 # 开始的所有内容:

#real-cool-heading
Run Code Online (Sandbox Code Playgroud)

无论您想要链接到 Real Cool 标题部分的位置,请将所需的文本放在括号中,然后将锚链接放在括号中:

[Go to Real Cool Heading section](#real-cool-heading)
Run Code Online (Sandbox Code Playgroud)


Jay*_*eli 6

接受的答案对我不起作用,因为我的标题也是一个链接:

之前(不起作用):

Table of contents 

 1. [Header Name](#header-name)


### [Header Name](https://google.com)
Run Code Online (Sandbox Code Playgroud)

之后(为我工作):

Table of contents 

 1. [Header Name](#header-name)


### Header Name

https://google.com
Run Code Online (Sandbox Code Playgroud)

这是当你不想使用 html 并希望使用已接受的解决方案并在自述文件中进行一些权衡时。