LoginSignup
8
2

More than 5 years have passed since last update.

GithubのREADME.mdでセクションにリンクを貼る方法

Last updated at Posted at 2016-11-17

やりたいこと

同一ページ内の要素へのリンクを貼りたい。

<div id="hoge">Jump to here</div>

<a href="#hoge">Jump</a>

解決策①

  • divタグを書いてidつけちゃう。
  • 僕は以前までこれやってました。
[Jump to Section1](#section1)

<div id="section1">
# Section1
    - hogehogehoge...
</div>

[結果]

Jump to Section1

Section1

- hogehogehoge...

解決策②

  • 自動で付けられるidを使う。
  • # Hoge のようにセクションを書くと、セクション名がすべて小文字になった#hogeというidが自動で付与されるらしい。
  • # Hoge Fugaのようなセクションの場合には区切りが-に変換されて#hoge-fugaというidが自動で付与されるらしい。
[Jump to Section2](#section2)
# Section2
    - fugafugafuga...

[結果]

Jump to Section2

Section2

- fugafugafuga...

参考資料

  • たまたまのぞいた他人のREADME.md
  • これってどこかのReferenceに書いてありますか?
8
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
2