GitHub:如何在 readme.md 中添加链接到各个章节

huangapple go评论68阅读模式
英文:

github: how to add links to sections of readme.md

问题

我有一个 GitHub 项目,想要在 README 中添加链接,引用该 README 中的某些部分。我尝试了几种方法,一种是典型的 Markdown,另一种是基于 HTML 的带有锚点的方法。然而,在我的本地浏览器中一切正常,但在 GitHub 上点击链接时不能移动到正确的位置。

这可能是 GitHub 的一个 bug 吗?

以一个具体的示例为例:

https://github.com/Reissner/latex-maven-plugin
英文:

I have a github project and want to add links to the readme
referring to sections on that readme.
I tried several ways, one typical markdown, the other html based with anchor.
Whereas everything works well in my local browser,
on github clicking at the links to not move to the proper position.

Is this maybe a bug in github??

For a concrete example

https://github.com/Reissner/latex-maven-plugin

答案1

得分: 2

I've seen your markdown like:

in [Section 'Features'](#ssFeatures) 

## Features <a id='ssFeatures'></a>

You can try to use the following method:

in [Section `Features`](#feature)

## Feature

The "[Section 'Feature']" will be a link to "#Feature"

In addition, you can follow this README which has a lot of "link to section".

If I have answered your question to your satisfaction, then consider accepting the answer.

英文:

I've seen your markdown like:

in [Section &#39;Features&#39;](#ssFeatures) 

## Features &lt;a id=&#39;ssFeatures&#39;&gt;&lt;/a&gt;

Your can try to use the following method:

in [Section `Features`](#feature)

## Feature

The "[Section 'Feature']" will be a link to "#Feature"

In addition, you can follow this README which have a lot of "link to section".

If I have answered your question to your satisfaction, then consider accepting the answer.

huangapple
  • 本文由 发表于 2023年6月5日 05:44:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76402528.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定