[TxMt] Saving generated HTML from Markdown

Allan Odgaard throw-away-1 at macromates.com
Sun Apr 1 03:05:15 UTC 2007


On 1. Apr 2007, at 02:33, Lists In at IDC wrote:

> On Mar 31, 2007, at 8:17 PM, Brad Choate wrote:
>> If you like what you see in the preview window, you can hit Cmd 
>> +Option+U (the view source key in Safari and Mail.app) and you'll  
>> get a TextMate document with the HTML that was generated for the  
>> preview window.
> I was using the TextMate preview, doesn't seem to be a way to get  
> source out of there though that would be, obviously, very handy.

There is (as Brad said :) ). It’s View → View Source (⌥⌘U).

>> Alternatively, you can use the "Convert Document to HTML" (Ctrl 
>> +Shift+H) command from the Markdown bundle in the Markdown document.
>
> That seems to convert to HTML in situ, is there an option to create  
> a new HTML document from the source you're viewing?

Go to Bundles → Show Bundle Editor → Edit Commands… (⌃⌥⌘C)

Now locate Markdown → Convert Document / Selection to HTML (second  
item in the Markdown bundle) and change the “Output” from  
“Replace Selected Text” to “Create New Document”. Now ⌃⇧H  
will open a new window with the HTML.

> Seems like this should be easier...

Manually converting your Markdown formatted text to HTML in TextMate  
and saving that somewhere is NOT a recommended workflow, and that is  
why we do not have a “Save the HTML to a new location” command by  
default (but it would be easy to add).

Let me clarify on the purpose of using Markdown, it may arise in two  
situations:

  1) You are writing content for your blog, manual, web-site, or  
similar. In this case you want your content to STAY in Markdown, and  
have the conversion happen on display (potentially cached), i.e.  
never inside TextMate (here you only need the Preview command) -- the  
reason you want the content to stay as Markdown is so that you can go  
back and edit the easy-to-read version of your content.

  2) You are submitting content, which is required to be in HTML, to  
somewhere, for example a comment on a blog. Here you want to write in  
Markdown, convert to HTML, and submit that (likely throwing away the  
original, since you generally do not keep a local copy of your  
comments to blogs, etc.) -- if for example it was a web-site comment,  
the workflow could be to invoke “Edit in TextMate” from the  
browser, write in Markdown, press ⌃⇧H to convert it to HTML, now  
save, close, and submit.




More information about the textmate mailing list