-
Notifications
You must be signed in to change notification settings - Fork 560
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
Add/copy rendered markdown #579
Conversation
Testing works as expected, but I'm having a weird behaviour on selection. The attached gif should be clear, but this is what seems to happen. Though, this happens on master as well, so it's not caused by any changes made here. |
Yay! I totally missed that review request, gonna give it a look asap!
Means that it only happen in Edit mode (which only exists for Markdown, therefore "Markdown Edit" 🙂), but not in Preview. |
As noted here, I tried with a fresh I got no issues, apparently because |
`marked` doesn't appear to have been maintained for a while while `showdown` has more recent contributions. Further, `marked` was missing some functionality that we wanted. Namely, we wanted an equivalence with Github-flavored Markdown (gfm) and `showdown` does it better. In this patch we've changed the way we are inserting the content. Instead of using `dangerouslySetInnerHTML` we're statefully rendering the content into the DOM and then manipulating it. This change provides an easier way to interact with the rendered content because we can operate at the DOM level instead of at the string level. For example, this is how highlighting now gets inserted. **Notable changes** - Todo items render (though they can only be changed in the plaintext view) - Tables render - Code blocks highlight based on their language - Certain dirty/malicious content gets sanitized before display **Questions** - Since the todo items render but aren't editable it could be confusing for someone to use, misleading them into thinking it's supposed to work
When viewing a note's Markdown preview and with no selection, if you press the copy shortcut then the rendered HTML for the note will fill the clipboard buffer. If there is some selected text then the copy will behave as normal.
5e4f58a
to
e117434
Compare
Updated @Copons so that now the vendor bundle builds with It appears like npm ls marked |
Markdown: Add ability to copy rendered note HTML
When viewing a note's Markdown preview and with no selection, if you
press the copy shortcut then the rendered HTML for the note will fill
the clipboard buffer. If there is some selected text then the copy will
behave as normal.
Testing
Open a note preview and hit ⌘+C or Ctrl+C. When pasting you should see HTML generated from the note. If you select some of the rendered content before copying you should find that when you paste it will be some kind of text view of the contents.