英文:
How to create a link to a markdown header in databricks?
问题
%md
我想引用来自另一个markdown单元格的databricks工作区内的一个markdown单元格。
所引用的单元格如下:
被引用的单元格如下:
%md
Buisiness Questions
如果我点击链接,它会将我导航到主页,因为它无法找到链接。
根据文档 ,我已经成功引用了该单元格,使用HTML超链接标记。然而,工作区、笔记本和单元格ID都是硬编码的,所以每次更改都需要适应。
如何在不硬编码任何ID的情况下链接markdown标题?
英文:
I would like to reference a markdown cell inside a databricks workspace from another markdown cell.
The reference cell is the following:
%md
[business questions](#buisiness-questions)
The referenced cell look like this:
%md
# Buisiness Questions
If I click on the link then it will navigate me to the home page because it can not find the link.
I have managed to reference the cell according to documentation using HTML hyperlink tag. However, the workspace and notebook, and cell IDs are hard-coded so anytime it is changed, adaptation is necessary.
%md
<a href="https://adb-[some_id].azuredatabricks.net/?o=[some_id]#notebook/[some_id]/command/[some_id]">business questions</a>
How to link a markdown header without hardcoding any IDs?
答案1
得分: 0
正如 @Saideep Arikontham 所提到的,目前没有办法以程序方式检索单元格的URL。幸运的是,如果单元格的顺序或内容发生更改,单元格的URL也不会更改。它还不会在工作区与集群分离或重新启动时更改。
因此,可以安全地使用超链接标记来引用单元格。
%md
<a href="https://adb-[some_id].azuredatabricks.net/?o=[some_id]#notebook/[some_id]/command/[some_id]">business questions</a>
注意: 请注意,如果单元格被删除,则单元格URL也将被删除。因此,可能需要进行单元格URL的适应。有关更多信息,请参阅 此处。
英文:
As @Saideep Arikontham mentioned there is no way to retrieve the cell's URL programmatically. Fortunately, the cell's URL is not changed if the cell's order or content changes. It will also not change if the workspace is detached from the cluster or restarted.
Therefore it is safe to use the hyperlink tag for referencing the cell.
%md
<a href="https://adb-[some_id].azuredatabricks.net/?o=[some_id]#notebook/[some_id]/command/[some_id]">business questions</a>
NOTE: Be aware that if the cell is deleted then the cell URL is also removed. So cell URL adaptation would be necessary. More information about identifiers.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论