jgm / djot

A light markup language
https://djot.net
MIT License
1.63k stars 43 forks source link

`[text][]` is shorthand for `[text][text]` – should `[text]()` mean `[text](text)`? #207

Open tmke8 opened 1 year ago

tmke8 commented 1 year ago

I could see this being useful for relative links:

You can find the PDF here: [paper.pdf]().

rendered as

<p>You can find the PDF here: <a href="paper.pdf">paper.pdf</a>.</p>

(spaces should be turned into %20 in href=)

Also, personal wikis could use this syntax to link to other files: (though this doesn't take into account file name extensions...)

Honey is produced by [bees]().

Note that the autolink syntax doesn't work for this:

<paper.pdf>

gets rendered as

<p>&lt;paper.pdf&gt;</p>
jgm commented 1 year ago

jgm/gitit has long used [bees]() as a syntax for wikilinks.

uvtc commented 1 year ago

See also #26

bpj commented 1 year ago

I think that it is probably wisest to leave the handling of empty links to renderers/filters since applications may differ as to what is the most sensible use for them: gitit uses them for wikilinks, so that [Link Text]() is short for [Link Text](some/path/link-text.html), my Pandoc filter uses them for local links so that [Link Text]() is short for [Link Text](#link-text) (and [Link Text](path#prefix#-suffix) is short for [Link Text](path#prefixlink-textsuffix) where each of path/prefix/suffix is optional — especially useful for [heading about thing](##s)! — and [Link Text](some/path.*) is short for [Link Text](some/path.<ext>) where the value of <ext> is declared in the metadata) and there may be other uses still.