Closed digitalmoksha closed 2 years ago
@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.
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:
make_bin('strong.md', '--to=foofoo')
--to=html
with and without --renderer
--to=xml
on a text with double quotes in it ("
)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 OPTIONS
header to let people know.
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.