Skip to content
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

Render custom markdown tags #240

Closed
mineshpatel1 opened this issue Jan 2, 2015 · 1 comment
Closed

Render custom markdown tags #240

mineshpatel1 opened this issue Jan 2, 2015 · 1 comment
Labels

Comments

@mineshpatel1
Copy link

I was looking at this article about modifying markdown to recognise custom tags and render them as classes on HTML elements.
Would you be able to instruct on how/where I'd begin editing MacDown code to get this behaviour working? Even if it's not put in here as a feature, I could edit it on my copy. Thanks very much.

@uranusjr
Copy link
Member

uranusjr commented Jan 3, 2015

The main problem of adding custom tags is that there is no consensus on how this can be done “correctly”. Patching the parsing program directly is far from ideal—it works when you write your own parser, but not for a all-in-one application.

MacDown does not use Markdown.pl like the article author, but a C implementation of the same speculation. The main difference between those two (aside from language) is that our implementation is based on text stream instead of regular expressions. This makes the parser a lot more performant and accurate, but the downside is that it is harder to customise. Namely, adding syntax rules anyway you like is nearly impossible (although it might be possible to add a “fallback” rule when no other applies).

But still, there is no consensus on how exactly this can be done, and with the community moving toward CommonMark, you might want to push it to standardise it; if CommonMark accepts it, everyone will feel comfortable implementing it.

You might want to look into relation discussions at hoedown/hoedown#99 (for our C implementation) and this CommonMark discussion.

Currently it’s difficult to modify the parser component in MacDown directly—you will need to fork Hoedown (i.e. the Markdown parser), patch it, host it in your own CocoaPods repository, and point MacDown to it instead of the official release. I do have plans on writing some instructions on this so that people can customise things more easily. I will report back when this is done.

I’m closing this because this probably won’t be touched in a while. But this is still a goal (although far away), and may be reopened in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants