如何在 Markdown 中引用 IPython 笔记本单元格? [英] How to reference a IPython notebook cell in markdown?
问题描述
如何在 IPython notebook markdown 中引用单元格?
How do I reference a cell in a IPython notebook markdown?
我知道如何引用外部链接.但是有没有办法给一个单元格分配一个ID,然后在markdown中引用这个单元格?
I know how to make a reference to an external link. But is there a way to assign an ID to a cell and then refer to the cell in the markdown?
推荐答案
是的,在 IPython 中可以做到这一点.
Yes, there's way to do just that in IPython.
首先,使用html
锚标记在要链接的单元格中定义目标,并为其指定Id
.例如:
First, define the destination in the cell you want to link with a html
anchor tag and give it an Id
. For example:
<a id='another_cell'></a>
注意 - 当您在 Markdown 中运行上述单元格时,它将变得不可见.您可以在锚点上方添加一些文本来标识单元格.
Note - When you run the above cell in markdown, it will become invisible. You can add some text above the anchor to identify the cell.
其次,在另一个单元格中使用 Markdown 语法创建指向上面创建的目标的内部超链接并运行它:
Second, create the internal hyperlink to the destination created above using Markdown syntax in another cell and run it:
[Another Cell](#another_cell)
现在,点击链接应该会将您带到目的地.
Now, clicking on link should take you to the destination.
这篇关于如何在 Markdown 中引用 IPython 笔记本单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!