icyleaf / markd

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

Fix issue with URI API change in crystal 0.30.0 #17

Closed bdtomlin closed 5 years ago

bdtomlin commented 5 years ago

Crystal has deprecated URI.escape and URI.unescape. Not only have they been deprecated, but URI.escape no longer has a variation that accepts a block. This causes markd to fail.

See v0.30.0 vs. v0.29.0

@icyleaf, I'm not sure how you would want to handle supporting different versions of Crystal, but this pull request currently just fixes the issue for 0.30.0, which breaks for older versions where the encode and decode methods didn't exist.

I think adding a note about versions to the top of the readme is adequate since Crystal is pre-release. I have included that here, but if you have other ideas I'm open.

In case you are wondering why I introduced the io variable, it's because there is only one encode method signature that accepts a block, and it writes to an IO.