[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Feature request: Allow export to convert broken links to plain t
Re: [O] Feature request: Allow export to convert broken links to plain text
Sun, 13 Jan 2019 13:33:47 -0800
This sounds like a good idea, but unfortunately it seems that the `broken-links:mark' option doesn't preserve the text of the link. In fact, looking at the source, the code that handles broken link errors doesn't even have access to the link's text, only the link target, so it's already too late once the org-link-broken signal is thrown. This also means that the implementation I was considering won't work.
So, it looks like I need to intercept execution earlier in the export process. Any ideas on how to do that?
On Sun, Jan 13, 2019 at 9:50 AM Berry, Charles <address@hidden
> On Jan 12, 2019, at 12:38 PM, Ryan Thompson <address@hidden> wrote:
> Hi all,
> I have a use case where I'd like for Org Mode to remove broken links while preserving their text when exporting. In particular, I'm exporting the same file multiple times with different sets of headlines excluded each time, and as a result I have to be careful of linking to headlines that might not be present in every export. It would be much easier if such links could simply be converted back to plain text for that export, while remaining as a link for any exports that *do* include the target headline. None of the existing settings do quite what I want. The "mark" option comes closest.
> I basically want "mark" but without adding any additional text around the link's text.
Sounds like a good use case for a filter. See
(info "(org) Advanced Export Configuration")
and scroll down to the `Filters' section.
Just use the `broken-links:mark' option and set up your link filter to strip the `BROKEN LINK:' part.