Am 16.07.16 um 22:46 schrieb Allan Odgaard:

On 16 Jul 2016, at 22:35, Stefan Daschek wrote:

Maybe we could introduce something like |TM_MARKDOWN_PREPROCESSOR| into the existing preview commands? With the idea that as long as this is not set (the default) it does nothing, but if it is set the document gets piped through this first before being processed further.

This sounds fine to me, however, this should probably be a list.

So your bundle would contain:

{    shellVariables = (
        {    name = 'TM_MARKDOWN_FILTER';
            value = '$TM_BUNDLE_SUPPORT/strip-frontmatter:$TM_MARKDOWN_FILTER';
        },
    );
}

And the preview command would have to do a “split” and run each (non-empty) filter.

This could be exploited by users as well, for example I could set TM_MARKDOWN_FILTER to something that generates table-of-contents or enumerate the headings etc.

Exactly! This sounds great. Should I prepare a pull request implementing this for the standard Markdown bundle ?