-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown, CommonMark: add support for wiki links. [API change] #7705
Conversation
Still needs documentation, but I'd already welcome feedback on the general direction. |
Two thoughts:
|
Given the diversity of wikis with divergent behavior, requiring a filter to match the exact results seems somewhat reasonable to me. I don't really have a strong opinion about implementing it in regular Markdown. On one hand, it would be nice to nudge more users to use CommonMark. But people relying on citations may not be able to switch. Also, @blackheaven did half of the work already in #6458. I think supporting it there as well would probably be the right choice. |
@@ -557,6 +558,11 @@ inlineToMarkdown opts lnk@(Link attr@(ident,classes,kvs) txt (src, tit)) = do | |||
| useAuto -> return $ literal srcSuffix | |||
| otherwise -> return linktext | |||
_ | useAuto -> return $ "<" <> literal srcSuffix <> ">" | |||
| useAuto && useWikilink -> return $ "[[" <> literal srcSuffix <> "]]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason for using this rather than the more portable <...> syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motivation here was to preserve as much information as possible, esp the fact that this is a wikilink. That "wiki-autolink" syntax appears to enjoy wide support across implementations. But just falling back to explicit title/url wiki syntax could be saver, if a little less concise.
@tarleb any thoughts on these comments? |
I'm sorry, I didn't get around to it yet. It'll probably take another month or so until I can go back and finish this. |
any progress ?? really want this feature |
Adds the Markdown/CommonMark extensions `wikilinks_title_after_pipe` and `wikilinks_title_before_pipe`. The former enables links of style `[[Name of page|Title]]` and the latter `[[Title|Name of page]]`. Titles are optional in both variants, so this works for both: `[[https://example.org]]`, `[[Name of page]]`. The writer is modified to render links with title `wikilink` as a wikilink if a respective extension is enabled. Pandoc will use `wikilinks_title_after_pipe` if both extensions are enabled. Closes: jgm#2923
Should be good to go: the Markdown reader now uses basically the same algorithm as CommonMark, with two exceptions: single |
Adds commonmark extensions
wikilinks_title_after_pipe
andwikilinks_title_before_pipe
. The former enables links of style[[Name of page|Title]]
and the latter[[Title|Name of page]]
. Titles areoptional in both variants, so this works for both:
[[https://example.org]]
,[[Name of page]]
.The writer is modified to render links with title
wikilink
as awikilink if a respective extension is enabled.
Pandoc will use
wikilinks_title_after_pipe
if both extensions areenabled.
Closes: #2923