WikiLinks support? #604

Open
opened 2026-01-29 14:40:54 +00:00 by claunia · 13 comments
Owner

Originally created by @alex-netkachov on GitHub (Jun 8, 2023).

Hi! I'm looking for the WikiLinks support (links within two square brackets, e.g. https://python-markdown.github.io/extensions/wikilinks/). Does this library support it, via plugin maybe?

If it is not supported, I do not mind to implement it. Could you maybe guide me a bit on what would be the right approach?

Kind regards,
Alex

Originally created by @alex-netkachov on GitHub (Jun 8, 2023). Hi! I'm looking for the WikiLinks support (links within two square brackets, e.g. https://python-markdown.github.io/extensions/wikilinks/). Does this library support it, via plugin maybe? If it is not supported, I do not mind to implement it. Could you maybe guide me a bit on what would be the right approach? Kind regards, Alex
claunia added the questionenhancementPR Welcome! labels 2026-01-29 14:40:54 +00:00
Author
Owner

@xoofx commented on GitHub (Jul 8, 2023):

Hi! I'm looking for the WikiLinks support (links within two square brackets, e.g. https://python-markdown.github.io/extensions/wikilinks/). Does this library support it, via plugin maybe?

Not that I'm aware of.

If it is not supported, I do not mind to implement it. Could you maybe guide me a bit on what would be the right approach?

I would start with an existing similar parser like the LinkInlineParser but Wikilinks should be simpler in the end (no image support, no special link rules as in regular links).

@xoofx commented on GitHub (Jul 8, 2023): > Hi! I'm looking for the WikiLinks support (links within two square brackets, e.g. https://python-markdown.github.io/extensions/wikilinks/). Does this library support it, via plugin maybe? Not that I'm aware of. > If it is not supported, I do not mind to implement it. Could you maybe guide me a bit on what would be the right approach? I would start with an existing similar parser like the [LinkInlineParser](https://github.com/xoofx/markdig/blob/master/src/Markdig/Parsers/Inlines/LinkInlineParser.cs) but Wikilinks should be simpler in the end (no image support, no special link rules as in regular links).
Author
Owner

@nightroman commented on GitHub (Sep 13, 2023):

This feature would be great for parsing Obsidian notes.
No pressure, just wondering, any development or plans?

@nightroman commented on GitHub (Sep 13, 2023): This feature would be great for parsing Obsidian notes. No pressure, just wondering, any development or plans?
Author
Owner

@alex-netkachov commented on GitHub (Sep 14, 2023):

As the topic starter, I feel that I need to inform you that I will not proceed with it further because I no longer use wikilinks. The name clashes in the large knowledge base have become too much of a nuisance.

@alex-netkachov commented on GitHub (Sep 14, 2023): As the topic starter, I feel that I need to inform you that I will not proceed with it further because I no longer use wikilinks. The name clashes in the large knowledge base have become too much of a nuisance.
Author
Owner

@djradon commented on GitHub (Oct 9, 2023):

I would also love this feature... very useful for Dendron workspaces.

@alex-netkachov FYI, Dendron solves the namespacing issue using hierarchical dot notation, e.g. languages.c-sharp is distinct from tags.c-sharp

@djradon commented on GitHub (Oct 9, 2023): I would also love this feature... very useful for Dendron workspaces. @alex-netkachov FYI, Dendron solves the namespacing issue using hierarchical dot notation, e.g. [[languages.c-sharp]] is distinct from [[tags.c-sharp]]
Author
Owner

@QINGCHARLES commented on GitHub (Oct 17, 2023):

Describe the basic specification for this.

Take a phrase in your document, e.g. cheese on toast

You add double square brackets around it, e.g. cheese on toast

It becomes an in the rendered document, with the href set to cheese_on_toast ?

What are the rules to slugify the phrases? How do you deal with punctuation?

Just trying to flesh it out. I'm using markdig for a wiki right now, but I'm forcing the users just to make full links because I've not got it smart enough to do it wiki-style yet.

@QINGCHARLES commented on GitHub (Oct 17, 2023): Describe the basic specification for this. Take a phrase in your document, e.g. cheese on toast You add double square brackets around it, e.g. [[cheese on toast]] It becomes an <a> in the rendered document, with the href set to cheese_on_toast ? What are the rules to slugify the phrases? How do you deal with punctuation? Just trying to flesh it out. I'm using markdig for a wiki right now, but I'm forcing the users just to make full links because I've not got it smart enough to do it wiki-style yet.
Author
Owner

@djradon commented on GitHub (Oct 18, 2023):

Hi @QINGCHARLES. I believe spaces in links are not supported, so it would look like cheese-on-toast which would set the href to "cheese-on-toast.md".

FWIW, I use the "VS Slug" plugin, which in turn uses https://github.com/sindresorhus/slugify - but I would say slugification shouldn't be necessary for this use case... Just expect the phrase to correspond directly to a filename without the ".md" extension.

@djradon commented on GitHub (Oct 18, 2023): Hi @QINGCHARLES. I believe spaces in links are not supported, so it would look like [[cheese-on-toast]] which would set the href to "cheese-on-toast.md". FWIW, I use the "VS Slug" plugin, which in turn uses https://github.com/sindresorhus/slugify - but I would say slugification shouldn't be necessary for this use case... Just expect the phrase to correspond directly to a filename without the ".md" extension.
Author
Owner

@QINGCHARLES commented on GitHub (Oct 19, 2023):

@djradon That's a format I've not seen before for "Wiki" style links. The original wikis used a strange CamelCaseFormat like that to create links, which clearly isn't very readable for normal humans. The link at the top of this thread, which I finally remembered to check out, uses basically the same format as WikiMedia, which is close to ideal as it allows spaces and punctuation in links and then does its best to slugify them in a way where they end up looking often identical to the original text.

The one I decided on for my wiki allows spaces in the text, but uses a hyphen instead of an underline in the link, and lower-cases everything, just because that's my personal preference for links.

I'm hard-pressed to see the use case for the one in your post -- is there a specific reason you don't want spaces in the link text? Obviously it makes converting it to a filename even easier, but filenames actually are less restricted than URL slugs as they can more easily have spaces in them.

@QINGCHARLES commented on GitHub (Oct 19, 2023): @djradon That's a format I've not seen before for "Wiki" style links. The original wikis used a strange CamelCaseFormat like that to create links, which clearly isn't very readable for normal humans. The link at the top of this thread, which I finally remembered to check out, uses basically the same format as WikiMedia, which is close to ideal as it allows spaces and punctuation in links and then does its best to slugify them in a way where they end up looking often identical to the original text. The one I decided on for my wiki allows spaces in the text, but uses a hyphen instead of an underline in the link, and lower-cases everything, just because that's my personal preference for links. I'm hard-pressed to see the use case for the one in your post -- is there a specific reason you don't want spaces in the link text? Obviously it makes converting it to a filename even easier, but filenames actually are less restricted than URL slugs as they can more easily have spaces in them.
Author
Owner

@QINGCHARLES commented on GitHub (Oct 19, 2023):

(p.s. I wish there was a way to hack into the InlineLink function to modify its functionality without having to write a whole new one from scratch)

@QINGCHARLES commented on GitHub (Oct 19, 2023): (p.s. I wish there was a way to hack into the InlineLink function to modify its functionality without having to write a whole new one from scratch)
Author
Owner

@djradon commented on GitHub (Oct 22, 2023):

@QINGCHARLES My use case is for Dendron, which only allows dashes in filenames, and the wikilink corresponds directly to the filename (without the .md extension), see https://wiki.dendron.so/notes/90mrtp10ucyyvt60qekuj4y/. But supporting spaces would be fine, doesn't affect my use case.

@djradon commented on GitHub (Oct 22, 2023): @QINGCHARLES My use case is for Dendron, which only allows dashes in filenames, and the wikilink corresponds directly to the filename (without the .md extension), see https://wiki.dendron.so/notes/90mrtp10ucyyvt60qekuj4y/. But supporting spaces would be fine, doesn't affect my use case.
Author
Owner

@Temetra commented on GitHub (Nov 14, 2023):

I wrote a simple extension for an Obsidian-based static site generator I'm working on, and thought I'd share it here. It'll probably need tweaking for other use cases, but hopefully someone finds it useful.

@Temetra commented on GitHub (Nov 14, 2023): I wrote a simple [extension](https://github.com/Temetra/MarkdigExtensions) for an Obsidian-based static site generator I'm working on, and thought I'd share it here. It'll probably need tweaking for other use cases, but hopefully someone finds it useful.
Author
Owner

@djradon commented on GitHub (Nov 14, 2023):

It'll probably need tweaking for other use cases, but hopefully someone finds it useful.

Thanks! Unfortunately, Dendron wikilinks have reversed the page name and the alt text order, so UI Components instead of what I now realize is the standard way of putting the actual page/note title first.

@djradon commented on GitHub (Nov 14, 2023): > It'll probably need tweaking for other use cases, but hopefully someone finds it useful. Thanks! Unfortunately, Dendron wikilinks have reversed the page name and the alt text order, so [[UI Components|ui-components]] instead of what I now realize is the standard way of putting the actual page/note title first.
Author
Owner

@Temetra commented on GitHub (Nov 14, 2023):

Ah, that's a shame. I think the easiest way to fix that would be to swap the assignments in WikilinkParser.cs, lines 97-98.

@Temetra commented on GitHub (Nov 14, 2023): Ah, that's a shame. I think the easiest way to fix that would be to swap the assignments in WikilinkParser.cs, lines 97-98.
Author
Owner

@QINGCHARLES commented on GitHub (Nov 14, 2023):

Yes, it would be easy to modify your code @Temetra. I checked it out, very nice, thank you. We need more example extensions like this to learn from.

@QINGCHARLES commented on GitHub (Nov 14, 2023): Yes, it would be easy to modify your code @Temetra. I checked it out, very nice, thank you. We need more example extensions like this to learn from.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#604