Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use markd for markdown rendering in the compiler #11040

Merged
merged 3 commits into from Aug 2, 2021

Conversation

straight-shoota
Copy link
Member

This is a revival of #8174, pulling in https://github.com/icyleaf/markd/ and using it for markdown rendering in the docs generator and playground.

The markdown implementation we're currently using was previously part of the standard library but got yanked because it's broken. We still used it in the compiler. This finally replaces it with a dedicated library that is proven to work well.
To avoid external dependencies for the compiler, the markd shard is vendored into the Crystal repository using git subtree. The entire code is embedded in the repository, but it's easy to pull in upstream changes using git subtree pull.
The first two commits are just git subtree pulling in the code from markd.

Only the third commit is interesting for review, integrates markd with the compiler and adds specs to make sure the output is as expected and the mentioned bugs are indeed fixed.

The generated docs HTML is mostly identical with the previous implementation, except for some insignificant white space changes and more encoded special characters. And of course, a lot of broken behaviour is fixed.

Resolves #4613
Fixes #7009
Fixes #7463
Fixes #10058

NOTE: This must not be squash merged to keep the commit information for git subtree.

Copy link
Member

@asterite asterite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! And it's so much better than my headlong attempt. Thank you! ❤️

@j8r
Copy link
Contributor

j8r commented Jul 29, 2021

Glad the final chosen approach iswith git subtree at the end, some were not very keen to go this way at first.

Hopefully the Readme and License will remind us to submit patches upstream.

@straight-shoota straight-shoota added this to the 1.2.0 milestone Jul 29, 2021
Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 💯 Thank you @straight-shoota 🙏

@straight-shoota straight-shoota merged commit 32659bc into crystal-lang:master Aug 2, 2021
@straight-shoota straight-shoota deleted the feature/markd branch August 2, 2021 11:33
@straight-shoota
Copy link
Member Author

The newly generated docs are already live at https://crystal-lang.org/api/master/
A clear indicator of a working markdown implementation is that <https://github.com/crystal-lang/crystal/fork> in the README is properly rendered as a hyperlink.

Please let us know about any issues with the new renderer, discovered on https://crystal-lang.org/api/master/ or while building shards.

@icyleaf
Copy link
Contributor

icyleaf commented Aug 3, 2021

Good news! I am happy to make this happened 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment