[TxMt] paste html as markdown?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[TxMt] paste html as markdown?

Tim Bates
I’ve been working with some old html that is moving to a markdown-based site.

Textmate has a neat feature where if you drop an html file onto your markdown window, its contents are pasted… as markdown! (neat!).

Question/feature request:
1. Can we have a “convert from html" command in markdown?

2. Is there an option on the html processor to [give](normal) links instead of [bibliography][1]

[1] Style links?


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[TxMt] Re: paste html as markdown?

Graham Heath
Hi Tim,

The command that’s used to convert a dropped file to markdown can be simply re-worked to "convert from html" command. I’ve attached it, but you can also simply install the attached command.

I’ve simply opened the command Bundles -> Markdown -> File Drop Actions -> Insert HTML File as Markdown.

Copied the contents of the drop action to a new command (Cmd + N, select Command from the dropdown). Be sure that the new command is in the "Markdown" bundle, or the script that does the conversion won’t be located where its expected.

Then I changed 

python "$TM_BUNDLE_SUPPORT/bin/html2text.py" <"$TM_DROPPED_FILE"|perl -pe 's/\\/\\\\/g; s/`/\\`/g; s/\$/\\\$/g'

to

python "$TM_BUNDLE_SUPPORT/bin/html2text.py"  << "$TM_SELECTED_TEXT"

I’ve tried this, but only with a limited sample:

<p>
  This is a <a href="test.html">test</a>
</p>


As for #2, I think the short answer is "no". I’ve looked in the included version of the code, and I don’t see the support for this just. That said, there does seem to be a new version that might. Perhaps the file could be upgraded?


Thanks,

Graham Heath


On February 4, 2017 at 2:42:15 AM, Tim Bates ([hidden email]) wrote:

I’ve been working with some old html that is moving to a markdown-based site.

Textmate has a neat feature where if you drop an html file onto your markdown window, its contents are pasted… as markdown! (neat!).

Question/feature request:
1. Can we have a “convert from html" command in markdown?

2. Is there an option on the html processor to [give](normal) links instead of [bibliography][1]

[1] Style links?


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate

Convert From HTML.tmCommand (1K) Download Attachment
Loading...