RobertDober / earmark_parser

The Markdown to AST part of Earmark.
Apache License 2.0
68 stars 26 forks source link

Support for "wikilink" style links #18

Closed sionide21 closed 4 years ago

sionide21 commented 4 years ago

(Migrated from https://github.com/pragdave/earmark/pull/377)

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

RobertDober commented 4 years ago

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

sionide21 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

RobertDober commented 4 years ago

Great waiting for 1.5 now!