-
-
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
Add support for rendering XML from cmark-gfm #144
Add support for rendering XML from cmark-gfm #144
Conversation
2bebc0e
to
640c40d
Compare
`cmark-gfm` supports rending to the XML format and exports the correct functions. Added support to the `Node` class so you can now do `doc.to_xml`. Also added support for a new command line option, `—to=FORMAT` that allows you to specify `html` or `xml` as the output format
Command line arguments `--to=commonmark` and `--to=plaintext` are now supported
640c40d
to
5f92e5c
Compare
@gjtorikian I think this is ready for your consideration if you have time. The reason I added this is that we would like to be able to output as XML, particularly since that's currently the only format that supports inline source mapping. |
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.
I've given this a once-over and it looks fine to me 👍 I am very tired, though, so will wait for Garen to give the final OK.
I think this looks great. Thank you for your contribution. I tend to lean extra hard on the side of caution/paranoia when working with FFI. Could you add a few more "malicious" test cases, such as:
Those are a few I can think of off the top of my head. Obviously it looks like the code would be able to handle such situations but better safe than sorry! At least the first one, in any event, should be test. The README should also be updated, probably a quick blurb under the |
and add additional specs.
d21acea
to
8710dd9
Compare
Thanks @gjtorikian and @kivikakk for taking a look! I've added some additional specs, and made unrecognized formats abort like the other options. I also took a stab at updating the README. |
Nice nice nice. Thank you! |
cmark-gfm
supports rending to the XML format and exports the correct functions. So I've added support to theNode
class so you can now dodoc.to_xml
.Also added support for a new command line option,
—to=FORMAT
(which mirrors the option incmark-gfm
) that allows you to specify the output format. Sinceto_plaintext
andto_commonmark
were already supported internally, possible output formats ishtml
,xml
,plaintext
, andCommonMark
. For examplecommonmarker --to=xml
Currently
man
andlatex
are not supported output formats.