Brett Viren writes: > I want what may be two conflicting things: > > - Produce a monolithic HTML export of an main org file that #+include:'s > other org files. > > - Have links in the other org files that are valid both when the > monolith is exported to HTML and when visiting the individual org > files in Emacs. I can see the rationale, but it is tricky. > === a.org === > * A > > This is A. > === b.org === > * B > > This is B. Links: > - [[file:a.org::*A][A by file with headline]]. > - [[A][A by headline only]]. > > === main.org === > ... > * Includes > > #+include: a.org > #+include: b.org In this scenario, it indeed makes sense to replace links to a.org and b.org with internal links. However, someone who is exporting multiple files, including a.org/b.org may actually want to keep links to a.org/b.org. In particular, when only portions of a.org/b.org are included (like a single src block or certain lines). > * Links > > - A :: [[file:a.org]] > > - B :: [[file:b.org]] And this is actually a scenario where it also makes more sense to keep the links to a.org/b.org. If we follow your suggestion, these would be > - A :: [[file:main.org]] > > - B :: [[file:main.org]] which would look confusing. For reference, I am attaching a patch that blindly converts links to included files into links to the top-level includer. However, the patch will fail for partially included files where the portions the links are referencing are not actually included. It will also replace A:: and B:: links in the above example. So, it is not suitable for inclusion in Org - we need some better idea how to handle other possible scenarios. Suggestions welcome! (For now, I do not see how we can handle the described scenarios cleanly)