-
Notifications
You must be signed in to change notification settings - Fork 0
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
Replace Redcarpet by CommonMarker #419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests to make sure the behavior is as expected.
d5da141
to
eaafce3
Compare
eaafce3
to
a35df6f
Compare
a35df6f
to
7174310
Compare
d9588a5
to
46b32a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tests, it looks much better.
52ee84e
to
1d61211
Compare
spec/lib/markdown_spec.rb
Outdated
expected_result_in_html = '<p><a href="https://fractalsoft.org/">' \ | ||
"<img src=\"/path/to/my_image\" alt=\"My image\" /></a></p>\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected_result_in_html = '<p><a href="https://fractalsoft.org/">' \ | |
"<img src=\"/path/to/my_image\" alt=\"My image\" /></a></p>\n" | |
expected_result_in_html = <<~HTML | |
<p><a href="https://fractalsoft.org/"><img src="/path/to/image" alt="My image" /></a></p> | |
HTML |
1d61211
to
424a486
Compare
We were missing tests to check the conversion from Markdown to HTML. While writing the missing tests, I found out that some implementations for using Redcarpet didn't work. We had added some Redcarpet extensions, [1] but they did not load in the application when we used them. To be more specific, the Redcarpet extensions were not enabled in the application where we were using them. This was the reason for refactoring the code. The tests that check for correct conversion of Markdown to HTML with Redcarpet pass. [1]: https://www.writesoftwarewell.com/how-to-render-markdown-views-in-rails/
> Ruby wrapper for the comrak (CommonMark parser) Rust crate [1] [1]: https://github.com/gjtorikian/commonmarker
We replace Redcarpet with CommonMarker [1] because the latter has more features and is faster. [2] This helps to render HTML from Markdown better. I had to refactor the tests due this change. [1]: https://github.com/gjtorikian/commonmarker/blob/v1.0.0.pre11/README.md [2]: https://github.github.com/gfm/
Since Redcarpet [1] is not used anywhere, I have removed it. [1]: https://github.com/vmg/redcarpet
424a486
to
aa89b81
Compare
Pull Request Summary
It is part of a larger task to add pages describing industries where we can help as programmers. CommonMarker has more features and is faster than Redcarpet. This helps for better rendering of HTML from Markdown.
Feedback
N/A
UI Changes
N/A