Louis Vigneras <louis.vigne...@dgfip.finances.gouv.fr> writes:

> Following yantar92’s suggestion on the matrix channel, I am reporting 
> here what appears to be a bug.
>
> I have an index.org file with the following:
> #+include: chapter-1.org
> #+include: chapter-2.org
>
> In chapter-1.org I have the following:
> * Heading
> [[file:chapter-2.org::*Heading 1][Link to heading 1]]
>
> In chapter-2.org I have the following:
> * Heading 1
>
> Text
>
> When exporting to both PDF and HTML, links are rendered as follows:
>
> ```latex
> \href{chapter-2.org}{Link to heading 1}
> ...

I checked the sources, and it is not a bug. Rather a missing feature.

> I believe the expected behavior should output links referring to 
> headings of the output document. It should not refer to the org file for 
> the PDF output, nor the chapter-2.html file for the HTML output as it 
> only produces an index.html file.

I agree that it would be expected.
On the other hand, it would not be trivial to implement.
Consider, for example,
#+include: chapter-1.org
#+include: chapter-2.org :lines 2-20

What should we do in such situation?

In addition, there could be duplicates in heading names and a link that
would otherwise be unique as <file:chapter-2.org::*Heading 1> may no
longer be, after we include multiple files, if another included file
also contains * Heading 1.

Note also that the reference is not broken - the reference should still
be valid.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to