cgiffard/Downsize — pull request #11 by zethraeus (2014-02-12 02:17:39+00:00)
Title: Allow for 'contextual' tags which are not clipped.

Christopher,

This is the commit i most want to land in the project.

The motivation is to modify Downsize to output nicer blog snippets in Ghost.

The idea is to allow the user to specify a list of tags whose content should not be cleaved.
I believe this can be especially useful in allowing you to specify the core markdown top block elements ["p", "ul", "ol", "pre", "blockquote"] that have intra-article-level semantic meaning and NOT specify tags used for layout that don't covey any context (div etc.) or tags that convey context at a high level (article, header etc).

The implementation is a simple set intersection of the open tag stack and the passed list of 'contextual tags'.

I'd love to gauge your interest in this feature! If you're not opposed, please let me know if there's anything you'd like improved in the implementation!

The test won't pass without https://github.com/cgiffard/Downsize/pull/9. (If you do want to use all the commits I've thrown at you, you can also just merge my master branch and save the conflict annoyance.)

-adam