icyleaf / markd

Yet another markdown parser, Compliant to CommonMark specification, written in Crystal.
MIT License
109 stars 30 forks source link

Refactor HTMLRenderer code block languages #37

Closed straight-shoota closed 3 years ago

straight-shoota commented 3 years ago

This patch extracts a couple of methods in HTMLRenderer which allow to easier hook in to change certain aspects of a render method, without having to override the entire method and duplicate all steps.

Use cases are for Crystal's API docs rendering: https://github.com/crystal-lang/crystal/blob/32659bc7c6be76111afc3dc00ef4ac5fcee5806d/src/compiler/crystal/tools/doc/markd_doc_renderer.cr (see https://github.com/crystal-lang/crystal/pull/11040).