Julien Dallot <[email protected]> writes:

> Based on what we discussed so far, here are some high-level guidelines we may 
> want to follows:
> - we want to be able to include arbitrary metadata inside an org link (in 
> plain text form)
> - we want to be able to store arbitrary metadata in the org element (once the 
> link was parsed)
> - whenever possible, we want to follow web standards for links.

I am not sold on storing metadata.
But we can certainly extend the existing notion of :search-option beyond
just file links.

Currently, we support a number of search options using ad-hoc syntax
like
<file.txt::<line number>>
<file.txt::text to search>
<file.txt::/regexp/>
<file.txt::* headline search>
<file.txt::#id-search>

Arguably, these options can be useful beyond file (and Org) links.

One of the general ideas behind Org mode is that Org markup should be
human-readable.

So, something like [[file.txt::line=<line number>]] would make a lot of
sense in my eyes. Or, more generally [[file.txt::keyword=value]].

Using (:keyword value ...) syntax might also work. Maybe even dropping
outer parens - the idea is to get something similar to
attributes and header arguments:

[[file.txt:: :page 1 :highlight (0.24 0.47 0.33 0.49)]]

> Based on those criteria, here is a possible alternative for the pdf link I 
> presented at the beg of this thread:
> [[file:<path>#page=1#highlight=0.240196,0.478535,0.331699,0.494949]]
> and here is the "web-compatible" equivalent of current org link with 
> ::<search-text> at the end:
> [[file:<path>#:~:text=<search-text>]]

> The idea is that the link content (inside [[]]) is an (almost) working web 
> link.

I do not think that we should aim for such compatibility.
Web links are not very human-readable, and Org mode tries to be
human-readable.

Rather we can allow web links specifically to follow their syntax and
parse it appropriately. Say, we can extend :search-option to be not just
a string, but also a plist, and parse it beyond file: link - in other
link types.

-- 
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