Jupyter中目錄生成

Jupyter 中沒有直接生成目錄的工具,因此你需要一旦HTML的東西來生成目錄。

目錄

生成目錄你需要兩個東西

1.Destination

<a href='#inter_link'>2.The internal hyperlink</a>

<a href='#代碼'>本文代碼</a>

<a id='needs'></a>

生成目錄你需要兩個東西:

  1. 目標(biāo) Destination。關(guān)鍵語句:
<a id='destination_tag'></a>
  1. 一個到目標(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>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容