mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-08 05:44:58 +00:00
WikiLinks support? #604
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
@xoofx commented on GitHub (Jul 8, 2023):
Not that I'm aware of.
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).
@nightroman commented on GitHub (Sep 13, 2023):
This feature would be great for parsing Obsidian notes.
No pressure, just wondering, any development or plans?
@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.
@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
@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.
@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.
@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):
(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)
@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.
@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.
@djradon commented on GitHub (Nov 14, 2023):
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.
@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.
@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.