Am 16.07.16 um 21:44 schrieb Allan Odgaard:

On 16 Jul 2016, at 18:41, Stefan Daschek wrote:

So in principle I want to implement a preview command that just strips the frontmatter and then delegates to whatever else preview command would have been normally used, if this bundle would not be installed (like calling `super` in an overridden oop method).

How many Markdown preview commands are out there?

There’s at least the one from Markdown (GitHub) (a bundle I happen to be using :-).

The default Markdown bundle uses TM_MARKDOWN to convert the text to HTML so it can be used with alternative Markdown processors (I use it with multimarkdown), so not sure what the motivation would be to create new preview commands.

Markdown (GitHub) also uses TM_MARKDOWN, but defaults to (a bundled version of) redcarpet.rb.

After all, I don’t really want to create a new preview command, I’d rather somehow “hook into” the existing preview command(s). (My bundle should only care about stripping the YAML front matter and not impose its own choice of markdown processor.) So setting TM_MARKDOWN isn’t really suitable, as far as I understand.

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.