yuin / goldmark

:trophy: A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.
MIT License
3.68k stars 255 forks source link

Does it support custom tags? #147

Closed GildedHonour closed 4 years ago

GildedHonour commented 4 years ago

Does it support my own custom tags?

If yes, if I wanted to extend it with my own tag:

[my_tag123]aabb[/my_tag123] ==> <some_custom_html_tag>aabb</some_custom_html_tag>

how would I?

yuin commented 4 years ago

You can write an extension for goldmark. goldmark-mathjax may be a good example for you.

jallbrit commented 4 years ago

Why could you not just write the HTML tag directly? [myTag]content here[/myTag] is just as easy as <myTag>content here</myTag>.

GildedHonour commented 4 years ago

Why do you use markdown at all, if you could write html tags directly?

jallbrit commented 4 years ago

@GildedHonour: markdown provides shortcuts for a lot of HTML. For example, when I write:

This is a quote in markdown. It's so easy!

That gets generated into <blockquote>This is a quote in markdown. It's so easy!</blockquote>. This is really handy and useful, because with that single > character, I can save the trouble of writing out the 2 <blockquote> tags.

Going from [my_tag123]aabb[/my_tag123] ==> <some_custom_html_tag>aabb</some_custom_html_tag> does not save any keystrokes, you're just using a different character for tags ([/] instead of </>).

Make sense?