Jupyter 中沒有直接生成目錄的工具,因此你需要一旦HTML的東西來生成目錄。
目錄
<a href='#inter_link'>2.The internal hyperlink</a>
<a href='#代碼'>本文代碼</a>
<a id='needs'></a>
生成目錄你需要兩個東西:
- 目標(biāo) Destination。關(guān)鍵語句:
<a id='destination_tag'></a>
- 一個到目標(biāo)的內(nèi)部超鏈接 Internal hyperlink.關(guān)鍵語句:
[name shown in content](#destination_tag)
<a id='destination'></a>
1. Destination
在需要出現(xiàn)在目錄中的地方插入一個空的 HTML 定位標(biāo)記并給他一個id, 例如:
<a id='the_destination'></a>
注意:
1.id也可以使用name,但是name在HTML5中不再使用了,建議使用id。因為你可能把Notebook導(dǎo)出為html并放在其他地方
2.創(chuàng)建destination的語句最好單獨放在一個cell里面,如果放在destination一個cell中,在jupyter中沒用影響,但是在html中有問題。例如這里我是在“1. Destination” 之前建了一個cell輸入<a id='the_destination'></a>
<a id='inter_link'></a>
2.The internal hyperlink
有兩種方式:
1.使用goode olde HTML,在名字前使用hash標(biāo)識#將一個fragment identifier 放在目錄中:<a href='#the_destination'>Link to the destination</a>,例如:
<a href='#inter link'>2.The internal hyperlink</a>
2.更簡單的方法是使用Markdown語法:[Link to the destination](#the_destination),例如:
[2.The internal hyperlink](#inter link)
<a id='代碼'></a>
本文代碼
目錄中的代碼:
# 目錄
[生成目錄你需要兩個東西](#needs)
[1.Destination](#destination)
<a href='#inter_link'>2.The internal hyperlink</a>
<a href='#代碼'>本文代碼</a>
三個標(biāo)題前分別插入的描述destination的cell:
<a id='needs'></a>
<a id='destination'></a>
<a id='linter_link'></a>
<a id='代碼'></a>