3

如何在 org-mode 中链接到单独页面的一部分并将其链接到 html 中?例如,如果在文件 file.org 中,我有一个 X 部分的标签:

** Section X
#+LABEL: sec:X

[[sec:X][section X]]我可以在 file.org中参考本节。[[file:file.org][link to file.html]]我可以从外部文档链接到 file.org (并且在发布时会自动链接到相应的 html 文件)。但在本文档之外,我不能将第 X 节称为[[file:file.org#sec:X][link to section X of file.html]]因为节标签已转换为数字(例如,sec-3_1)。因此,我必须将其链接为[[file:file.html#sec-3_1][link to section X of file.html]],但假设我知道sec:X标签将转换为sec-3_1...

(我正在使用用于org-publish-project转换的默认函数。)

4

1 回答 1

5

来自: http: //orgmode.org/manual/External-links.html#External-links

file:sometextfile::NNN                    file with line number to jump to
file:projects.org                         another Org file
file:projects.org::some words             text search in Org file
file:projects.org::*task title            heading search in Org file

编辑: 更好地使用“CUSTOM_ID”属性,如

  file1.org
  -------------

  * Section
    :PROPERTIES:
      :CUSTOM_ID: my_section_link_id
    :END:

然后在要链接到 file1.org:Section 的 file2.org 中

  * Sectoin In File2
    - Link to [[file:file1::my_section_link_id][Section]] in File1

我认为 orgmode 7.4 中存在一个错误,如果您使用“file:file1::#my_section_link_id”它会生成不正确的 html 链接,但会生成正确的 org 链接。如果您使用“file:file1::my_section_link_id”生成正确的 html 链接,但不正确的 org 链接。

于 2011-01-20T17:28:49.480 回答