Don't use the "Pipe text through" option. Instead, create a new command, scoped so it will only be triggered within the context you want, with the key shortcut ⌘⌥⌃P (that's cmd-opt-control-P). The output format should be View As HTML. This way you can press ⌘⌥⌃P and get what appears to be a web preview, but is really the results of your command.
For examples, look at how Markdown does this.
On Dec 5, 2006, at 12:09 PM, Hans-Joerg Bibiko wrote:
I have a small question.
If I write a command which should do something with highlighted text of my current document I can specify within the myCommand.tmCommand the plist key 'inputFormat' as 'xml' (e.g. Create HTML from Document). OK.
But now I want to write a script which should be called by the Web Preview option 'Pipe text through'. Here I don't get the content of my current document with xml markups for syntax highlighting.
Is there a way without changing TM's source code to receive these xml markups?
Many thanks in advance !!!!!!!!!! ;)