sponsor Vim development Vim logo Vim Book Ad

MarkdownCopy : Copy Markdown to clipboard as HTML

 script karma  Rating 0/0, Downloaded by 1398  Comments, bugs, improvements  Vim wiki

created by
Al Budden
 
script type
utility
 
description
A simple plugin to allow copying of buffers formatted as markdown to the clipboard as formatted HTML text.  This can be used, for example, to write emails in markdown in Vim and then paste them into Outlook as formatted text.

The plugin currently only supports Windows, although it wouldn't be too hard to port `HtmlClipboard.py` to support other operating systems and I'd welcome pull requests.  I only wrote this to allow me to write Outlook emails in Vim, so haven't tried to support Linux/Mac OS X at the moment.

Note that this uses the `HtmlClipboard` python class written by Phillip Piper and published on activestate.com.  Links in the README.md file included in the zip file.

I only added the vim code.

The plugin offers two commands:

:CopyToClipboardAsHtml
:PasteFromClipboardAsMarkdown

Hopefully the names make it fairly clear what they mean.  CopyToClipboardAsHtml accepts a range, but will default to sending the entirety of the current buffer.

Source code is held in a repository at https://bitbucket.org/abudden/vim-markdowncopy
 
install details
Requirements

1. Vim >= 8.0.254 (this plugin uses `:pyx` commands to interact with python).
2. Vim must be compiled with working python support.
3. Python compatible with Vim.  I've only tested this with python 3.6 at present, although it should work with any python 2.7+.
4. Python module pywin32.
5. A markdown-to-html (and vice-versa) conversion tool.  I use pandoc.

I have tested this with 64-bit Anaconda Python 3.6.1 (which comes with pywin32 as standard), 64-bit Vim 8.0.776 from tuxproject.de and pandoc 1.19.2.1.  It was written in about half an hour so may well have a lot of bugs!

Install as per any other Vim plugin - I'd recommend pathogen, but there are plenty of other plugin managers available.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
MarkdownCopy_1.1.0.zip 1.1.0 2017-09-13 8.0 Al Budden Added inline styles to allow syntax-highlighted code to be copied into Outlook (or similar) with colours.
MarkdownCopy_8f9d8fe836c1.zip 1.0.0 2017-09-11 8.0 Al Budden Initial upload
ip used for rating: 18.97.9.175

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github