Skip to content

Support for "wikilink" style links#18

Merged
RobertDober merged 5 commits intoRobertDober:masterfrom
sionide21:wikilinks
Nov 27, 2020
Merged

Support for "wikilink" style links#18
RobertDober merged 5 commits intoRobertDober:masterfrom
sionide21:wikilinks

Conversation

@sionide21
Copy link
Copy Markdown
Contributor

(Migrated from pragdave/earmark#377)

This is commonly used in markdown based wikis (for example, Github's wiki).

sionide21 added 4 commits July 7, 2020 22:50
Since other markdown parsers disagree on how to translate a wikilink to
a URL, and since there was already a spec saying Earmark isn't
responsible for bad URLs, I simply pass the link text through directly.
This matches how `python-markdown` treats them and allows for easy
manipulation in the AST, which is important wince we do no formatting of
the link internally.
@RobertDober
Copy link
Copy Markdown
Owner

Great work thank you, I will merge this as soon as 1.5 is under dev

@sionide21
Copy link
Copy Markdown
Contributor Author

What is the meta map in each AST node for? Should I be putting the fact that this is a wikilink there instead of seeing a class name?

@RobertDober
Copy link
Copy Markdown
Owner

Hmm, actually this might be a good idea, because it would allow to reverse the code.

But great you talked about this because I actually do not like the {"class", "wikilink"} in the attributes array. I feel that the renderer should do such things... (I should have looked better, but anyway no big deal)

Let me give you some background information:

Right now we have only two defined entries verbatim: true in case we parsed html and comment: true in case we parsed html comments. However, I am considering to follow the request to put the raw html into the meta map in case of html, not sure how to do it though, probably option based and maybe only for the outermost node.

Eventually the decision is yours, if you want to add wikilink: true to the map I am fine with it.

Concerning the class name, any particular reason why you put it there, maybe I'll leave it in there but I prefer the metadata approach.

@sionide21
Copy link
Copy Markdown
Contributor Author

I agree it makes more sense in the metadata. I'll make the change.

@RobertDober
Copy link
Copy Markdown
Owner

Great waiting for 1.5 now!

@RobertDober RobertDober added this to the 1.5 milestone Jul 17, 2020
@RobertDober RobertDober self-assigned this Jul 17, 2020
@RobertDober RobertDober merged commit 9ebe401 into RobertDober:master Nov 27, 2020
@sionide21 sionide21 deleted the wikilinks branch November 27, 2020 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants