Pages

Sunday, November 4, 2012

Using markdown format with TextMate

You want to execute "pandoc" when "⌘-R" is clicked, what would you do? There are some ideas you need to understand.
  • Scope selection
  • Activation
  • Command
  • Environment Variables

Scope selection and Activation

Many of the keys are already assigned, so when you try to use the popular key such as "⌘-R", you need to select the scope. In other words, you need to teach TextMate that when you click "⌘-R" in markdown, it means something special. Screen Shot 2012 11 04 at 2 56 11 PM

Command

In command editor, you can give any UNIX command you want. And many of the predefined environment variables are already given.

Combining the command and variable, you can come up wit the following commands.
/usr/local/bin/pandoc "$TM_FILEPATH" -o "$TM_FILEPATH".html
/usr/bin/open "$TM_FILEPATH".html
echo File: "$TM_FILEPATH"
Screen Shot 2012 11 04 at 3 02 07 PM

References

No comments:

Post a Comment