# RTE: cleanup imported document code

**URL:** https://meta.discourse.org/t/rte-cleanup-imported-document-code/386713
**Category:** Feature
**Tags:** composer
**Created:** [October 25, 2025, 7:20am UTC](https://meta.discourse.org/t/rte-cleanup-imported-document-code/386713 "2025-10-25T07:20:20Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [October 26, 2025, 2:03pm UTC](https://meta.discourse.org/t/rte-cleanup-imported-document-code/386713/6 "2025-10-26T14:03:27Z")

</div>

If you paste a clipboard with this exact `text/html` content in rich editor mode you get a content resulting in this markdown:

````markdown
## Plattenplatz ermitteln

Filtern auf ext4, was ist verfügbar?

```
 root@tokoeka ~ # df -h -t ext4 --total Filesystem Size Used Avail Use% Mounted on /dev/mapper/pve-root 196G 39G 148G 21% / /dev/md0 486M 400M 57M 88% /boot /dev/mapper/pve-data 3.0T 560G 2.3T 20% /mnt/data /dev/mapper/pve-backup 414G 40K 393G 1% /mnt/backup total 3.6T 598G 2.8T 18% - 
```

 

Filtern auf ext4, was wird genutzt?

```
 root@tokoeka ~ # df -h -t ext4 --output=used Used 39G 400M 560G 40K 598G 
```

````

It’s lossy regarding stuff we don’t care about (`div`s, `class`es, etc), but will understand `hN`, `pre`, or anything defined in our ProseMirror schema, respecting our [various editor extensions](https://github.com/search?q=repo%3Adiscourse%2Fdiscourse%20parseDOM&type=code) registering [`parseDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM) definitions used by ProseMirror’s parser, including those from theme components or plugins.

As for the original request:

> [@Thomas\_Rother](#):
>
> But I am missing an option to clean up junky code imported from other systems …

I think when the rich editor is loading the document, it’s not this same HTML anymore, is it?

Because a post `raw` containing HTML blocks should be rendered as a “pass-through” code editor node:

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/4/1/f41e0855510748f6b5c080ad0dd291b42809a0d7.png)

This can then be edited the same way it could in Markdown mode.

---

_[View the full topic](https://meta.discourse.org/t/rte-cleanup-imported-document-code/386713)._
