-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
cmark extensions #28
cmark extensions #28
Conversation
Not sure if you're aware but it's totally fine for the Windows build to fail: #22 I should get on that....one day. 😞 Other than that, this is looking great. The two things that stand out are:
I'm not nervous about switching the submodule to your fork. I am nervous about the core CMark stuff getting improvements, that might not trickle down to your fork. For example, I routinely run Could/Would you be willing to also incorporate those upstream C changes into your fork, so that I can continue to release new gems with those updates? If not, I'm totally open to any other suggestions or improvements on the workflow here. For example, could any of the C extension code be written directly to this repo, rather than maintained in a separate submodule? |
Haha, whoops! If I ever get a Windows dev environment going I might look into it. I could've sworn I had a good reason to use symbols instead of strings — maybe it was because one of the extension names had a hyphen in it. At any rate, I'll change it to use symbols there; will look much better! I'm super happy to track the upstream cmark and integrate — hopefully it'll only be a matter of time before this code does get merged upstream, so it'll be helpful for me to do this anyway, to make sure it always stays merge-ready. :) Unfortunately the nature of the changes (adapting cmark to be extensible) means we can't easily separate it yet. I'm hoping the core changes will land, and then we'll be able to keep the extensions proper in this repo if we wanted/needed. |
Symbols are in, |
btw, Windows build failures currently look a little different to #22; might be http://help.appveyor.com/discussions/problems/4294-all-builds-say-specify-a-project-or-solution-file-the-directory-does-not-contain-a-project-or-solution-file ? |
We get conflicts in msxml.h if we don't do this. It looks like the CMARK_ prefix on our enum is getting ignored by the compiler somehow ...?!
This at least has it compiling with RubyInstaller + DevKit.
Windows is all fixed. Let me know if there's anything else you'd like addressed! |
😹 |
- bundle -v | ||
|
||
test_script: | ||
- bundle exec rake |
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.
OCD ALERT: can this end in a newline please? 🙏
@@ -15,26 +15,28 @@ module CommonMarker | |||
# | |||
# text - A {String} of text | |||
# option - Either a {Symbol} or {Array of Symbol}s indicating the render options | |||
# extensions - An {Array of String}s indicating the extensions to use |
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.
Should be {Array of Symbol}s
.
html.force_encoding('UTF-8') | ||
end | ||
|
||
# Public: Parses a Markdown string into a `document` node. | ||
# | ||
# string - {String} to be parsed | ||
# option - A {Symbol} or {Array of Symbol}s indicating the parse options | ||
# extensions - An {Array of String}s indicating the extensions to use |
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.
Should be {Array of Symbol}s
.
@@ -17,11 +17,22 @@ def walk(&block) | |||
# Public: Convert the node to an HTML string. | |||
# | |||
# options - A {Symbol} or {Array of Symbol}s indicating the render options | |||
# extensions - An {Array of String}s indicating the extensions to use |
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.
Should be {Array of Symbol}s
.
assert_raises(TypeError) { CommonMarker.render_html(@markdown, :default, "nope") } | ||
assert_raises(TypeError) { CommonMarker.render_html(@markdown, :default, ["table"]) } | ||
assert_raises(ArgumentError) { CommonMarker.render_html(@markdown, :default, %i[table bad]) } | ||
end |
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.
Love the error cases--thank you!
|
||
none_in_use = CommonMarker.render_html(@markdown, :default, %i[table strikethrough]) | ||
refute none_in_use.include?("| a") | ||
refute none_in_use.include?("~~hi~~") |
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.
Could we get some assertions on the expected HTML, for example, <strike>hi</strike>
or <td>a</td>
? (For these, and the tests above.)
Also, could you demonstrate what happens with something like, asterisks in a table cell? github-markdown
does support this at the moment.
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.
Can do! I had left these out as cmark itself tests the cases, but I think it makes sense to assert they're working properly here too.
This is looking goooood! I left a few more comments. Thanks for your patience. |
Fixed up. And not at all, thanks for your attention! :) |
Shipping as 0.11.0! |
This is not yet ready for merge, but I figure opening a PR is an okay idea at this stage.
In short:
extensions
branch of cmark: https://github.com/kivikakk/cmark/tree/extensionsFixes #22.