<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 16 Jul 2016, at 18:41, Stefan Daschek wrote:</p>

<p dir="auto"></p></div>
<div style="white-space:pre-wrap"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><div dir="auto">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).
</div></blockquote></div>
<div style="white-space:normal">

<p dir="auto">How many Markdown preview commands are out there?</p>

<p dir="auto">The default Markdown bundle uses <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">TM_MARKDOWN</code> 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.</p>

<p dir="auto"></p></div>
<div style="white-space:pre-wrap"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><div dir="auto">Is this possible?
</div></blockquote></div>
<div style="white-space:normal">

<p dir="auto">As implied, the default command just pipes the input through whatever the <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">TM_MARKDOWN</code> variable is set to (falling back on <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">Markdown.pl</code>), so you could redefine this variable to have it strip YAML frontmatter.</p>

<p dir="auto">In theory this can be done by a bundle (and it can even be set to something like <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">$TM_BUNDLE_SUPPORT/my-preprocessor</code>). Unfortunately though, if the user also sets <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">TM_MARKDOWN</code>, their value overrides what you have set it to.</p>

<p dir="auto">So I think it would be necessary to introduce a defined API for sharing functionality. A command can require other bundles and reference their content, and as mentioned above, they can also set variables, so there are a few ways to go about this.</p>
</div>
</div>
</body>
</html>