miyuchina / mistletoe

A fast, extensible and spec-compliant Markdown parser in pure Python.
MIT License
841 stars 119 forks source link

Fix for part of #108, Update to CommonMark v0.30 #156

Closed anderskaplan closed 2 years ago

anderskaplan commented 2 years ago

This PR fixes nine of the failing examples in the CommonMark 0.30 specification. They all had in common that content inside code spans was not handled according to the spec.

This was solved by preserving space and escape sequences during parsing, and by removing leading and trailing space according to the spec during HTML rendering.

The PR also includes a fix for a warning, a simplified way to download the spec tests examples, and an improvement to the spec test runner.

pbodnar commented 2 years ago

@anderskaplan, thanks for another contribution, I will try to look at this soon. Where do you take time for it all? ;)

BTW I think that with all the past and most recent fixes, we can slowly release version 1.0.0 of mistletoe...? Also note the project's status equal to "alpha" on https://pypi.org/project/mistletoe/ - not sure if this isn't unnecessarily low, it looks like this can be changed in setup.py, maybe I should create a dedicated issue for that... :)

anderskaplan commented 2 years ago

You're welcome! 😄 It's a nice hobby project.

I don't have much of an opinion about when and how to release the 1.0.0, but I agree that "alpha" sounds unnecessarily low. Especially given that there are quite a few projects depending on it already!

pbodnar commented 2 years ago

You're welcome! 😄 It's a nice hobby project.

Same here. :) And I'm primarily using it via CopyQ to copy-paste my markdown notes to whatever format I need... :)

I don't have much of an opinion about when and how to release the 1.0.0, but I agree that "alpha" sounds unnecessarily low. Especially given that there are quite a few projects depending on it already!

OK, thanks for your feedback, then I would at minimum remove the "alpha" from the mistletoe version soon. :)

anderskaplan commented 2 years ago

There, updated according to comments.

pbodnar commented 2 years ago

@anderskaplan, thank you. So if you're not against, I'm going to put the commits as-is onto the master branch - even though changes in the last commit could be probably squashed into its parent commit, I think it is not that critical to do...

anderskaplan commented 2 years ago

Great, please go ahead!