Implict MediaWiki/Gollum-style [[page links]]


As an extension, it would be useful to be able to type link text in double square brackets and have a relative URL be generated automatically. Variations of the double square bracket syntax can be found on MediaWiki and Gollum wikis.

Gollum page links look like this:

[[Frodo Baggins]]


<a href="/frodo-baggins">Frodo Baggins</a>

MediaWiki accepts the following syntax:

[[Frodo Baggins]]

Which produces:

<a href="/wiki/Frodo_Baggins">Frodo Baggins</a>

I prefer hyphens to underscores, and my understanding is that search engines do as well. My suggestion is to go with the Gollum syntax.

It might also be worth removing the forward slash at the beginning of the href output. For example:

[[Frodo Baggins]]

would instead produce:

<a href="frodo-baggins">Frodo Baggins</a>

This means that if the Frodo Baggins article was nested under /wiki, you could get to it from another article also nested under /wiki without needing to type [Frodo Baggins](/wiki/frodo-baggins) using the regular Markdown link syntax.

As further polish, URLs could be generated cleanly, replacing special characters with words. The Stringex library for Ruby does this particularly well. Here are the examples from the Stringex readme, but using the proposed page link syntax:

[[simple English]]

<a href="simple-english">simple English</a>

[[it's nothing at all]]

<a href="its-nothing-at-all">it's nothing at all</a>

[[rock & roll]]

<a href="rock-and-roll">rock & roll</a>

[[$12 worth of Ruby power]]

<a href="12-dollars-worth-of-ruby-power">$12 worth of Ruby power</a>

[[10% off if you act now]]

<a href="10-percent-off-if-you-act-now">10% off if you act now</a>

[[kick it en Français]]

<a href="kick-it-en-francais">kick it en Français</a>

[[rock it Español style]]

<a href="rock-it-espanol-style">rock it Español style</a>

[[tell your readers 你好]]

<a href="tell-your-readers-ni-hao">tell your readers 你好</a>


Popular and needed extension
I wonder if there is a wiki engine that uses markdown
Beyond Markdown

Is there any relation to:?

Basically, you “declare root url” on top of page, and then use CURIEs to append the root url to your url. If you could combine CURIEs with your proposal, then that might be useful. Perhaps the root url can be declared via document metadata or sitewide options.


Compact URIs (CURIEs)

I haven’t looked into that topic yet, but in this case the wiki style links are just a shorthand for writing normal Markdown links.

[[Frodo Baggins]]

is shorthand for:

[Frodo Baggins](frodo-baggins)

Whatever extensions apply to the latter would apply to the former too.


Compact URIs (CURIEs)
I wonder if there is a wiki engine that uses markdown

Okay. Hmmm… well my next concern will be. If we have relative links in a document. What would happen if we relocate the document to a different website or location. Do you have a way to declare in perhaps the document declaration metadata on what is the original root url for the relative urls. e.g.

% relativeURL(INPUT) =

   Links to -->  

Also can you declare more than one kind of root url… e.g.

   Links to -->
   Links to -->

edit: Okay, I moved the concept over to CURI



IMO, it’s a feature that the URLs are relative. If Wikipedia changed their domain, or another site forks the project (which actually happened with Citizendium), the URLs will continue to work.

There might be some cases where you would want to explicitly declare a root URL, but let’s discuss that in the Compact URLs topic since that is a different feature from what I am proposing here.

1 Like


Implicit wiki links are also used in Taiga Markdown: