Max Nikulin <maniku...@gmail.com> writes: >>> 2021-09-03 5:17 Dr. Arne Babenhauserheide Bug: PDF Export of Link fails >>> https://list.orgmode.org/87pmtqp79s....@web.de/T/#u >>> >>> Timothy suggested to fix `org-insert-link' somehow in than thread. >> >> Yeah. I recall a number of bug report related to this behaviour. >> Though I wanted to focus on org-insert-link here. > > Then the older bug may be cancelled as a duplicate.
Not sure. Even a fix to org-insert-link would not solve the problem with unexpected export if the link is typed in manually. So, I'd rather keep both the reports for the time being. Or someone may go through all the related bugs and create a single giant discussion to avoid scattering things around. In my notes, I have at least 6 discussions related to edge cases of Org markup. >>> Unfortunately It requires an additional export filter to remove zero >>> width spaces. >> >> Yeah. Right. It should even be an easy patch, which would be welcome :) > > I meant a custom user filter. I consider zero width spaces as the last > resort. Nicolas considered making zero width spaces an official part of > syntax stripped during export and a way to preserve some of them. I think it is already kind of official. At least, we directly suggest using zero width spaces in https://orgmode.org/manual/Escape-Character.html#Escape-Character The other thing is that ox.el does not do anything about zero width spaces. > In the case of links I still prefer breaking emphasis at the link > borders. `org-insert-link' may check after inserting the markup if it > is parsed as a link and add more markers if necessary. > ... > /inter/[[https://orgmode.org/?oops=1][/word/]]/link/ I do not like this idea. It is fine when inserting a link into existing emphasis, but what if an emphasis is applied around link later? We would also need to update org-emphasize and still have an issue because many users simply type the emphasis markers manually. > I am afraid that zero width spaces in link targets may lead to confusion > of users since in the most cases e.g. http: URLs may be pasted to > external application as is. We already escape '\' ,'[', and ']' in links. Zero width spaces will not make things much different. Of course, org-link-escape and org-link-unescape will need to be updated. Note that even copying Urls directly can be worked around using filter-buffer-substring-function. Best, Ihor