Emacs组织模式:组织到HTML转换 - 链接到不同页面中的部分?

hat*_*rix 3 emacs org-mode

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

** Section X
#+LABEL: sec:X
Run Code Online (Sandbox Code Playgroud)

我可以[[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转换的默认函数.)

jbp*_*jbp 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
Run Code Online (Sandbox Code Playgroud)

编辑: 更好地使用"CUSTOM_ID"属性

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

  * Section
    :PROPERTIES:
      :CUSTOM_ID: my_section_link_id
    :END:
Run Code Online (Sandbox Code Playgroud)

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

  * Sectoin In File2
    - Link to [[file:file1::my_section_link_id][Section]] in File1
Run Code Online (Sandbox Code Playgroud)

我认为orgmode 7.4中存在一个错误,如果你使用"file:file1 ::#my_section_link_id"它会生成错误的html链接,但是正确的组织链接.如果使用"file:file1 :: my_section_link_id"生成正确的html链接,但组织链接不正确.