Closed wrvsrx closed 2 years ago
It seems that wiki link with anchor support can just do that. Example syntax can be changed to
[[Tiger]]
means a link to Tiger.djot
.[[../a|Tiger]]
means a link to ../a.djot
with text Tiger
.[[a#anchor|Tiger]]
means a link to an anchor point named anchor
in a.djot
.Close it since wiki link (#26) should be able to do that.
Why
I saw you plan to add wiki link syntax (#26), then I was wondering if you plan to expand that wiki syntax to make it able to express accurate link to other djot files, even other djot blocks.
If we want to add a link to
a.md
, whose content isvia regular markdown link, we have to write it as
[link to a](a.html#anchor)
, which assume we want to convert the file to html. Wiki link is a better solution since it doesn't need to specify file extension name. But there are some cons of wiki link:a.html#anchor
An example syntax
Following syntax is a rough proposal, just for expressing what function it can give. You probably need to polish these syntaxs before they come to spec.
[[Tiger]]()
means a link toTiger.djot
.[[Tiger]](../a.djot)
means a link to../a.djot
with textTiger
.[[Tiger]](a.djot#anchor)
means a link to an anchor point namedanchor
ina.djot
.When being converted to html, link to
a.djot
should be replaced bya.html
.Pros and Cons
If djot have a spec about links between file (even with blocks and inline elements), there will be some pros:
Possible cons of that syntax is:
Text
of inputs instead of(FilePath, Text)
.