[TxMt] Re: paste html as markdown?

Graham Heath graham.p.heath at gmail.com
Sat Feb 4 19:54:14 UTC 2017


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
<https://github.com/Alir3z4/html2text/blob/master/docs/usage.md#available-options>
that
might. Perhaps the file could be upgraded?


Thanks,

Graham Heath


On February 4, 2017 at 2:42:15 AM, Tim Bates (timothy.c.bates at gmail.com)
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
textmate at lists.macromates.com
http://lists.macromates.com/listinfo/textmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20170204/f7ba6760/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Convert From HTML.tmCommand
Type: application/octet-stream
Size: 888 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20170204/f7ba6760/attachment.tmCommand>


More information about the textmate mailing list