Giter VIP home page Giter VIP logo

clipboard2markdown's Introduction

clipboard2markdown

Easily convert richly formatted text or HTML to Markdown. Use the clipboard and paste to Markdown with a single keypress.

The conversion is carried out by to-markdown, a Markdown converter running in the browser.

Demo

Interactive

http://euangoddard.github.io/clipboard2markdown/

Video

Screencast

Usage

Open index.html in a favorite browser and hit Ctrl+C (or ⌘+C on Mac).

To copy the converted Markdown to the clipboard, press Ctrl+A followed by Ctrl+C (or ⌘+A and ⌘+C on Mac).

One can paste multiple times. This overwrites the previous conversion.

Tested browsers

  • Chrome 33 (Linux and OS X)
  • Firefox 27 (Linux)
  • Safari 5 (OS X)
  • Internet Explorer 11 (Windows)

About

clipboard2markdown was created by Euan Goddard. The original version used html2markdown by Kates Gasis and Himanshu Gilani. Vegard Øye ported it to to-markdown by Dom Christie. The HTML template is based on Bootstrap.

License

License

Released under the MIT License. See the LICENSE file for details.

clipboard2markdown's People

Contributors

epsil avatar euangoddard avatar lurst avatar omgmog avatar tustin2121 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

clipboard2markdown's Issues

Chrome extensions

Hi! this is a great project. It would be great if we could have a Chrome extension that could directly copy the Markdown-conversion of the selected text on the webpage. I don't have much experience with web design, but do you think its an easy task?

Dirty HTML from Word leads to unwanted results

When content from Word is pasted, a lot of extra bonus-HTML is passed as well.

This can lead to words strung together: "like: thequick brownfoxjumps over the lazydog".

I fixed this (for a great deal) in a local project by simply stripping all unwanted things from the HTML.

  function sanitizeHtml(html) {
       // This destroys all (useless Word) <span> and <o:p> tags Word uses
       //  to set fonts on parts of the text and whatever
       html = html.replace(/<span[^>]*>|<\/span>/g, '');
       html = html.replace(/<o[^>]*>|<\/o[^>]*>/g, '');

       // This cleans all wanted tags by replacing anything after "<tag" until and excluding ">" 
       // By eradicating the second part, all extra settings per HTML tag are removed  
       html = html.replace(/(<\w+)([^\>]*)/g, '$1');

       // Clean up bold / italics mess that can lead to converson issues
       // This covers only the basic cases
       html = html.replace(/<\/b><b>/g, '');
       html = html.replace(/<\/i><i>/g, '');
       html = html.replace(/\s+<\/b>/g, '</b> ');
       html = html.replace(/\s+<\/i>/g, '</i> ');
       html = html.replace(/\s+<\/p>/g, '</p>');
       return html;
   }

Using it:

pastebin.addEventListener('paste', function() {
        setTimeout(function() {
            // Used here
            var html = sanitizeHtml(pastebin.innerHTML);

            output.value =convert(html);

            output.focus();
            output.select();
        }, 200);
    });

De solution is not tested for all cases.

native app

Have you ever thought of wrapping turndown into a cross platform desktop native app?

You may have your clipboard monitored and the paste-to-markdown feature triggered by, for instance, a hotkey.
Maybe it would not be extremely expensive to wrap turndown using React Native.

This would be definitively great!, and by the way, it would also make happy those who, like me, wish a turndown browser extension existed.

doesn't properly render tables

Hi, it is not created proper table when copied rows from excel sheet or webpage
It is producing like this

| time | logstamp | org_src | ip_src |
| 5/23/18 15:21 | 01:35.1 | Spectrum Business | 69.75.79.138 |
| 5/23/18 15:06 | 48:14.1 | | |

i would expect in below format so that it will be rendered correctly

| time | logstamp | org_src | ip_src |
| -- | -- | -- | -- |
| 5/23/18 15:21 | 01:35.1 | Spectrum Business | 69.75.79.138 |
| 5/23/18 15:06 | 48:14.1 | | |

output has hard spaces which are rejected in pandoc

Hi, I really appreciate this project. I've just had some trouble when using the output. When I put my text files through pandoc, I get a complaint about hard spaces which have been inserted. I think it's latex which is rejecting them. Let me know if you want more details. Some representations of the spaces are \20.

Allow paste to work on mobile

Thanks a ton for this!

On android, this doesn't seem to work, as there's no field to allow the long press menu to shown itself. (Specifically speaking android here.)

A small field that displays on it own (perhaps only visible on mobile, for clarity) might be a decent solution.

Thanks for any attention someone might feel inclined to offer to this. Open to pointers to the right place to look. :)

Ignore large images

pasted from evernote, images are converted to data-uri, I need an option to disable this behavior.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.