icyleaf / markd

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

GFM: Strikethrough support #62

Closed nobodywasishere closed 3 months ago

nobodywasishere commented 3 months ago

This pull request adds GitHub Flavored Markdown (GFM) strikethrough support (~~hello~~ => hello).

This also adds the gfm-spec.txt downloaded from here. To prevent a lot of broken specs that won't be fixed by this PR, the strikethrough specs have been copied to gfm-extra.txt temporarily.

require "./src/markd"

markdown = <<-MD
# Hello Markd

~~parser~~
:abc:

> Yet another markdown ~~parser :abc:~~ built for speed, written in Crystal, Compliant to CommonMark specification.
MD

options = Markd::Options.new(gfm: true, emoji: true)
puts Markd.to_html(markdown, options)
<h1>Hello Markd</h1>
<p><del>parser</del>
🔤</p>
<blockquote>
<p>Yet another markdown <del>parser 🔤</del> built for speed, written in Crystal, Compliant to CommonMark specification.</p>
</blockquote>