icyleaf / markd

Yet another markdown parser, Compliant to CommonMark specification, written in Crystal.
MIT License
109 stars 30 forks source link

Add GitHub emoji support #61

Closed nobodywasishere closed 3 months ago

nobodywasishere commented 3 months ago

This pull request adds support for GitHub style emojis (:abc: => :abc:). While emoji support isn't a part of GFM, this is still an important and useful part of markdown parsing that is really useful. It is currently disabled by default (and is enabled / disabled independent of the GFM option).

Example:

require "./src/markd"

markdown = <<-MD
# Hello Markd

`test`

> Yet another markdown parser built for speed, written in `Crystal`, Compliant to CommonMark specification. :confetti_ball: `world`

:abc: :cityscape:
MD

options = Markd::Options.new(emoji: true)
puts Markd.to_html(markdown, options)

Output:

<h1>Hello Markd</h1>
<p><code>test</code></p>
<blockquote>
<p>Yet another markdown parser built for speed, written in <code>Crystal</code>, Compliant to CommonMark specification. 🎊 <code>world</code></p>
</blockquote>
<p>πŸ”€ πŸ™</p>

This is just the start, I have more GFM support coming soon (strikethrough, bulleted list, etc). Trying to do it in small chunks to make PRs easier.