Feature Request: Support local wikilink namespace and external namespace like MediaWiki does.
xinbenlv opened this issue · 5 comments
Proposal is WIP
I am personally interested in working on this feature
Is your feature request related to a problem? Please describe.
I want the WikiLink to be expandable. Currently wikilink in vscode-markdown-notes organize all wikilink in a plain directory. It's a bit hard to organize as the number of markdown files scale up. Inspired by Wikipedia I like to propose a format of wikilink that's forward expandable, and backward compatible.
Describe the solution you'd like
Support local wikilink namespace and external namespace like MediaWiki does.
[[namespace:anther-topic| Another Topic]]
: renders as Another Topic[[:external-namespace:external-sub-namespace:anther-topic| Third Topic]]
: renders as Third Topic where as the external URI can be configured, and has a default, such as supporting Wikipedia sites just like you can write[[en:Earth]]
to point to Earth topic on English Wikipedia from any given Wikipedia language site or other Wikimedia sites.
So, in Wikipedia, name space works like this:
- [[Earth]] is the default namespace of article "Earth"
- [[Talk:Earth]] is the "Talk" namespace of Earth, which represents a discussion for page Earth.
Locally, it can be used to point to multiple directories. For example
- [note:my-project-meeting]]: point to
file:///<dir root>/note/my-project-meeting.md
- [people:join-smith]]: point to
file:///<dir root>/people/john-smith.md
Or configuration can point to a different directory
{
namespaces: [{
name: "note", relativePath: 'note/'
}, {
name: "people", relativePath: 'people/'
}, {
name: "log", relativePath: '../data/log/'
}]
}
We can also create cross-domain or cross-protocol external namespace
such as [[:wikidata:Q123456]]
With external namespace
{
external_namespaces: [{
name: 'wikidata', reference:'https://www.wikidata.org/wiki/%s'
}]
}
TODO(xinbenlv): 2020-12-01 complete this proposal.
Describe alternatives you've considered
I have considered using [link name](href)
.
Additional context
See https://www.mediawiki.org/wiki/Help:Links#Internal_links
This is possible with allowPipedWikiLinks
:
vscode-markdown-notes/package.json
Line 136 in 311dda9
Oh, hmm, no, those are not supported - so is the idea disambiguation when there are multiple meanings for the same word?
Would the file name on disk be namespace:anther-topic.md
for [[namespace:anther-topic| Another Topic]]
?
So, in Wikipedia, name space works like this:
- [[Earth]] is the default namespace of article "Earth"
- [[Talk:Earth]] is the "Talk" namespace of Earth, which represents a discussion for page Earth.
Locally, it can be used to point to multiple directories. For example
- [note:my-project-meeting]]: point to
file:///<dir root>/note/my-project-meeting.md
- [people:join-smith]]: point to
file:///<dir root>/people/john-smith.md
Or configuration can point to a different directory
{
namespaces: [{
name: "note", relativePath: 'note/'
}, {
name: "people", relativePath: 'people/'
}, {
name: "log", relativePath: '../data/log/'
}]
}
We can also create cross-domain or cross-protocol external namespace
such as [[:wikidata:Q123456]]
With external namespace
{
external_namespaces: [{
name: 'wikidata', reference:'https://www.wikidata.org/wiki/%s'
}]
}
Remove old proposal portion
[[default-topic.md]]
: already supported[[default-topic]]
: already supported
I like to propose it to support Topic alias
[[default-topic.md | Default Topic]]
, renders as Default Topic[[default-topic | Default Topic]]
, renders as Default Topic