New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to paste HTML and convert it to markdown on the fly #160

Closed
cyotek opened this Issue Jun 26, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@cyotek

cyotek commented Jun 26, 2016

Although one of the things I like about MDE is the lack of bloat, I'll log this feature request anyway in case it's useful for one than one person.

Sometimes I created MD documents based on existing HTML content. Normally I copy and paste, then delete the tags and convert it to markdown (which is a total pain in the so-and-so when doing tables)

I was recently using Pandoc to convert HTML files into git-hub flavoured markdown, I wonder if this is something worth adding to MDE... if you detect HTML on the clipboard (it has it's own format) then you can run it through Pandoc before adding to the document and take away some of the pain.

Thanks;
Richard Moss

@mike-ward

This comment has been minimized.

Show comment
Hide comment
@mike-ward

mike-ward Jun 26, 2016

Owner

My only issue here is what if you're pasting an example HTML snippet into your document? Is it too much UI to ask if HTML is detected what to do?

Owner

mike-ward commented Jun 26, 2016

My only issue here is what if you're pasting an example HTML snippet into your document? Is it too much UI to ask if HTML is detected what to do?

@cyotek

This comment has been minimized.

Show comment
Hide comment
@cyotek

cyotek Jun 27, 2016

If you aren't going to add a special action for this bound to a different hot key, then perhaps add an option. If the option isn't set (the default), then paste will act the same as always to avoid annoying existing users happy with the current implementation. If it is set, then it can prompt each time it detects CF_HTML on how you wish to proceed.

I suppose the problem with that is not all applications will be smart enough to use specific Clipboard formats and might just dump it in plain text regardless. In which case, perhaps a dedicated Paste HTML command might be a better option.

Or, maybe instead just a new document command, similar to Alt+F, but instead of formatting the document, it converts the selection. That way it doesn't matter how the content ended up in the document, no new option, no changed behaviours and no ambiguity.

cyotek commented Jun 27, 2016

If you aren't going to add a special action for this bound to a different hot key, then perhaps add an option. If the option isn't set (the default), then paste will act the same as always to avoid annoying existing users happy with the current implementation. If it is set, then it can prompt each time it detects CF_HTML on how you wish to proceed.

I suppose the problem with that is not all applications will be smart enough to use specific Clipboard formats and might just dump it in plain text regardless. In which case, perhaps a dedicated Paste HTML command might be a better option.

Or, maybe instead just a new document command, similar to Alt+F, but instead of formatting the document, it converts the selection. That way it doesn't matter how the content ended up in the document, no new option, no changed behaviours and no ambiguity.

@mike-ward

This comment has been minimized.

Show comment
Hide comment
@mike-ward

mike-ward Jun 27, 2016

Owner

Ponder I must the HTML paste 😄

Owner

mike-ward commented Jun 27, 2016

Ponder I must the HTML paste 😄

@cyotek

This comment has been minimized.

Show comment
Hide comment
@cyotek

cyotek Jun 27, 2016

Actually, I think my original idea of looking for CF_HTML isn't practical, as some applications use it to specify richer versions of plain text... e.g. our old friend Visual Studio. I noticed that when copying a plain C# snippet to the clipboard, it included both RTF and HTML in addition to the plain text formats. I can't imagine end users would be hugely happy if they pasted something they expected to be plain text and it suddenly turned into some HTML monstrosity.

In which case perhaps my final suggestion of adding some form of "HTML => Markdown" command to convert whatever text the user has currently selected is the optimal solution, and completely ignore clipboard formats.

cyotek commented Jun 27, 2016

Actually, I think my original idea of looking for CF_HTML isn't practical, as some applications use it to specify richer versions of plain text... e.g. our old friend Visual Studio. I noticed that when copying a plain C# snippet to the clipboard, it included both RTF and HTML in addition to the plain text formats. I can't imagine end users would be hugely happy if they pasted something they expected to be plain text and it suddenly turned into some HTML monstrosity.

In which case perhaps my final suggestion of adding some form of "HTML => Markdown" command to convert whatever text the user has currently selected is the optimal solution, and completely ignore clipboard formats.

@mike-ward

This comment has been minimized.

Show comment
Hide comment
@mike-ward

mike-ward Jun 27, 2016

Owner

That's my thought as well.

Owner

mike-ward commented Jun 27, 2016

That's my thought as well.

@mike-ward

This comment has been minimized.

Show comment
Hide comment
@mike-ward

mike-ward Jul 13, 2016

Owner

In the meantime, if you save your HTML to a file and then open in MDE (including drag and drop) it converts to Markdown.

There's also this web site: http://markitdown.medusis.com/

Owner

mike-ward commented Jul 13, 2016

In the meantime, if you save your HTML to a file and then open in MDE (including drag and drop) it converts to Markdown.

There's also this web site: http://markitdown.medusis.com/

mike-ward added a commit that referenced this issue Jul 24, 2016

@mike-ward mike-ward added the fixed label Jul 24, 2016

@mike-ward mike-ward closed this Aug 1, 2016

@cyotek

This comment has been minimized.

Show comment
Hide comment
@cyotek

cyotek Aug 1, 2016

Give it a quick test and it seems to be working nicely - thanks! That'll be a handy time saver converting documentation :)

cyotek commented Aug 1, 2016

Give it a quick test and it seems to be working nicely - thanks! That'll be a handy time saver converting documentation :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment