The string behind
:: is actually a search. In this context one understands the relevant comment in the source code of the function
org-html-link in the library file
ox-html.el (org 8.2.5).
;; Add search option, if any. A search option can be
;; relative to a custom-id or a headline title. Any other
;; option is ignored.
So, you can either replace
#my_anchor to form a custom-id or use a headline title starting with the character
In the second case don't include spaces after the
Linking section headers in other files only works when you publish org-mode projects. Org-mode projects are defined as members of the variable
org-publish-project-alist. See the documentation of this variable and Section 13 Publishing of the org-mode manual for the details.
* This is file a.org
Some important notes.
* Second Section
* Section with a custom-id
Some text before the custom-id
<<#my-anchor>> Here we have the custom-id
Some text behind the custom-id.
Text in file
* This is file b.org
* b.org contains the link to my_anchor
[[file:a.org::#my_anchor][My Link to the custom-id]]
[[file:a.org::*Second Section][My Link to the headline of the second section]]
The reason that links to headers in other files only work with publishing is that they are fetched from
org-publish-resolve-external-fuzzy-link which is used in
Section header links are actually numbered links, such as
sec-2 and the section headers are translated to the numbers 1,2,... via an association list in the variable
I consider this a documentation bug. The html-export of links of section headers in other files is not mentioned in Section 13.1.6 Links between published files of the org-mode manual. I can also not find any remark of the html-export of links to custom-id's across files in the manual.
I've just discovered these things through reading the source code.
This is what I got as an answer to my bug-report:
Thank you for the report.
Unfortunately, this feature is very experimental, and actually quite
buggy. It's not ready for prime time, and therefore not documented.