[TxMt] Re: Supporting YAML front matter in Markdown

Allan Odgaard mailinglist at textmate.org
Sat Jul 16 19:44:10 UTC 2016

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?

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.

> Is this possible?

As implied, the default command just pipes the input through whatever 
the `TM_MARKDOWN` variable is set to (falling back on `Markdown.pl`), so 
you could redefine this variable to have it strip YAML frontmatter.

In theory this can be done by a bundle (and it can even be set to 
something like `$TM_BUNDLE_SUPPORT/my-preprocessor`). Unfortunately 
though, if the user also sets `TM_MARKDOWN`, their value overrides what 
you have set it to.

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20160716/a03fdfa9/attachment.html>

More information about the textmate mailing list