Repository navigation
Support pasting more HTML elements #67
Description
Activity
Comment by @matthiaswenz, abridged:
This looks like a good fit for a time boxed implementation. I want to clarify the expectation on user experience here and confirm this with owners:
- When pasting via
cmd/crtl + vthe logic should attempt to discover any supported HTML formatting and turn it into Markdown - When pasting via
cmd/crtl + shift + v, it should paste verbatim, like also described in the changelog.
For any of HTML elements which have a single corresponding Markdown formatting (headings, bold, emphasize, ...) this looks to be pretty straightforward.
I'm cautious about any instances which rely on context/sequence of elements, such as
<ol><li>and the potential for nested lists. These might be simple from a well-formatted document, but given it's user input and HTML (😱) there could be all kinds of 🐉 in there, such as dealing with all kinds of HTML quirks, or having HTML within<code>which should then presumably not be interpreted.If we're ok with treating these more complex formatting options as iterative/progressive enhancements by starting with the simpler ones, I think this works well and should be low effort.
- When pasting via
In addition to the previously mentioned items, there is also the deleted text syntax:
name html markdown deleted text del,s,strike~~text~~There are also plenty of HTML tags that are supported by GitHub. Some more useful than others, and some lower effort than others.
Tag Preview Example Notes Estimated Effort kbdCtrl + V <kbd>Ctrl</kbd> + <kbd>V</kbd>Very useful and common in documentation low prepreformatted text
<pre>preformatted text</pre>Looks like triple-backticks but is semantically different (doesn't render a <code>block)moderate ttteletype <tt>teletype</tt>Probably not worth including; deprecated in HTML5 insinserted text <ins>inserted text</ins>Represents the text that replaces a del- important for semanticslow suptextsuperscript text<sup>superscript</sup>Very useful, no Markdown representation low subtextsubscript text<sub>subscript</sub>Very useful, no Markdown representation low dl,dt,dd- Term
- Definition of term
<dl><dt>Term</dt><dd>Definition of term</dd>This is fairly common, especially in documentation like MDN, and is a pretty useful list format that can't be represented in Markdown moderate summary,detailsSummary
Details...<details><summary>Summary</summary>Details...</details>This is probably not that common outside of GitHub markdown but we do use it a lot here - if you were quoting a comment it would be useful moderate ruby,rt,rp漢 <ruby>漢 <rt> ㄏㄢˋ </rt> <rp>alt</rp></ruby>Not to be confused with Ruby code. I don't really know what this is, to be honest 🤷 I hope this is a comprehensive list but I may have missed some.
This was originally an issue by @imjohnbo in
github/special-projects, a private repository: