Discourse has introduced an experimental HTML-to-Markdown pasting feature, enabled via the site setting enable_rich_text_paste. vinothkannans outlined supported elements including headings, emphasis, blockquotes, lists, code, tables, links, images, and limited HTML tags. Current limitations include no conversion of style attributes (e.g., from Google Docs), unsupported merged table cells, and limited ordered list (ol) handling from MS Word. The system falls back to plain text if conversion fails. Users praised the feature as “delightful” mcwumbly and “fantabulous” tobiaseigen, while reporting edge cases: Google Docs inline formatting fails due to reliance on style attributes alehandrof; email newsletters now paste with images after table-handling improvements tobiaseigen; MS Word lists now support nested ul tags vinothkannans but ol tags still flatten hierarchy schungx. codinghorror urged caution against bloating client-side code for rare Word edge cases. Image handling respects download remote images to local setting, with a 5-minute delay vinothkannans. alehandrof confirmed tightened list formatting from Google Docs is now fixed vinothkannans. The team invites continued testing and bug reports to refine stability.
Inline formatting from Google Docs doesn’t work. I hope the great Vinoth can dispel their dark magic. You can copy any bold or italic text from my test document to test this.
Other than that, the only thing that didn’t seem to be working is merged table cells –
but I don’t recall whether CommonMark even supports them (Pandoc did, but I couldn’t find a mention of this on the CommonMark site). So this is probably moot.
One thing that I’m not fond of in the current implementation is that it uses “loose” list items by default. I.e, this:
- List item 1
- List item 2
- List item 3
Instead of this:
- List item 1
- List item 2
- List item 3
I strongly prefer the latter over the former, which creates paragraphs in addition to list items. I have arguments in favor of my preference, but I realize that it is just that – a matter of taste/use cases/etc. If it’s not desirable to switch to the tight list items by default, is it possible to switch to offer an option to do so?
This is because Google docs using style attributes instead of inline tags like <b>, <i>, etc.,. As I mentioned we are not supporting it currently. But it’s doable. So we may add support for that after we reach a stable position in this feature.
Yes. It is tricky. Currently we are not supporting it. Let me check it with Markdown first.
I knew there was some sorcery going on there! I didn’t realize that that’s what you were referring to. I would love to see this implemented sometime as copy-pasting from Google Docs is a common use case for us.
The merged table cells was mostly a “what if”, since Sam asked for edge cases. It’s not something that’s ever come up my use of Discourse. (I had trouble pasting a Google Doc table with merged cells in my CMS yesterday, which is what gave me the idea to try.)
One issue I came across today - I just updated to latest. Previously (last week? two weeks ago? don’t remember), copy/pasting formatted newsletters from google email into discourse posts worked as you’d expect, with all pictures and formatting. Now it just pastes in whatever text there was without any formatting. I tried several and got the same result. For example, the newsletter below which is just one big image with a bit of text at the bottom just pastes the text at the bottom with no image. Copy/pasting from medium.com worked, so I can confirm the feature is working otherwise.
Good catch! They also using <![if !supportLists]> for ul and ol tags.
AFAIK both are working fine except inline formatting in Google Docs and olul tags in Microsoft Word. At least we don’t any regressions here. We already fallback to plain text paste in problematic situations.
Both needs some application specific workarounds which I will do after fixing all bugs in the current version.
It is not converting at all. Since it supports HTML it’s just displaying what it receive. If you look at the source then you can understand.
Hello friends,
I’ve noticed some strange behaviour with pasting pdf content. It seems the markdown formating commands are missing, but I’ve no clue why, the pasted text is shown with headings.
This is plain text paste only. Because markdown lists will have * instead of dots. I am not sure about PDF files whether it have HTML copy support or not. I will check.