subconsciousnetwork / subtext

Markup for note taking
Apache License 2.0
274 stars 20 forks source link

Support deep links #15

Open nichtich opened 3 years ago

nichtich commented 3 years ago

The issue of deep links has been brought up but not discussed yet in combination with multilinks. In short a deep link consists of

The content locator could best be specified separated by # as URI Fragment. Note that at least ` (space),|, and%` in URI Fragments must be escaped to allow splitting label and multiple links.

An example:

# Deep links in subtext
Links can contain content locators, given as URI Fragment. The syntax and semantic depends on document type.
For text such as subtext there is a specification:
& https://datatracker.ietf.org/doc/html/rfc5147|https://www.rfc-editor.org/rfc/rfc5147.txt RFC 5147
This link references the second and third line of a text document:
& ./document.st#line=2,3 Deep Link
gordonbrander commented 3 years ago

If we do bring in something like this, my sense is that it should follow the scroll-to-text approach https://wicg.github.io/scroll-to-text-fragment/

bburns commented 2 years ago

Yeah scroll-to-text is good -

To add a fragment directive to a URL like https://example.com, a fragment must first be appended to the URL: https://example.com#:~:text=foo. e.g. https://example.org/#test:~:text=foo will be parsed such that the fragment is the string "test" and the fragment directive is the string "text=foo".


Could specify a search? eg #search="foo bar"


GitHub lets you reference lines and line ranges -

https://github.com/subconsciousnetwork/subtext/blob/dbbf178fe9f3480c052b461fcb1752829c9b7df9/parsers/subtext.py#L8

https://github.com/subconsciousnetwork/subtext/blob/dbbf178fe9f3480c052b461fcb1752829c9b7df9/parsers/subtext.py#L12-L16

and github renders those as transclusions.

I kind of like "line" instead of "L", but referencing lines isn't as useful as text or search anyway, e.g. if you're using a "live" link instead of a "static" one.