kjdev / hoextdown

Hoextdown is an extension to Hoedown
MIT License
23 stars 15 forks source link

Cherrypicks d8d37c3013 from hoedown/hoedown #23

Closed mikesamuel closed 8 years ago

mikesamuel commented 8 years ago

I don't know whether you accept cherrypicks, but this is a cherrypick of https://github.com/hoedown/hoedown/commit/d8d37c3 . The commit message for that is included at the bottom.

My end goal is to get this patch into a fork of hoextdown used in some internal documentation tools.


To generate this change I did

$ curl -O https://github.com/hoedown/hoedown/commit/d8d37c3013dd957fb3dee6a31003baeae22d286e.patch $ patch -p1 < d8d37c3013dd957fb3dee6a31003baeae22d286e.patch $ make test


Comments in Markdown aren't really a thing, but they can come in super-useful. As alluded to in the test-case, MOE can be used to sync between internally developed projects and open-source versions. Part of that requires maintaining internal & external developer docs. MOE directives in comments make that a lot easier, but if they can't appear in the middle of a bullet list that becomes a lot harder.


src/document.c recognizes <!--...--> style comments as a standalone block.

src/smarty_pants.c seems to recognize them anywhere though I haven't tested.

This adds a test-case and tweaks document.c to copy HTML comments over the same way it copies tags over.

The HTML comment recognizing code is a bit of a copy/paste job from parse_htmlblock but that version does a bunch of extra work. I can factor out the common code if you'd like.

kjdev commented 8 years ago

Merged the source of https://github.com/hoedown/hoedown

a2fcfe3

mikesamuel commented 8 years ago

Thanks. Closing this pull.