In a discussion titled “RTE: cleanup imported document code” under the Feature category and tagged with composer, Thomas_Rother shares his experience migrating content from Dokuwiki to Discourse. He notes that Dokuwiki’s syntax isn’t clean Markdown, requiring manual editing. While using the old editor, he encounters cursor-jumping issues that make reformatting difficult. He also highlights that the main challenge isn’t Dokuwiki syntax itself, but embedded Bootstrap HTML (like <div> tags) from a custom template. pfaffman suggests that if the volume is large, a script or plugin might be more efficient than manual edits. renato asks for a code sample, and Thomas provides one showing Bootstrap markup mixed with terminal output. renato then demonstrates that pasting such HTML into Discourse’s rich editor converts it into clean Markdown, preserving headings and preformatted blocks while discarding irrelevant HTML like div classes — a lossy but practical workaround. The group agrees this approach works because Discourse’s ProseMirror schema handles common HTML elements like hN and pre, and the rich editor renders such blocks as “pass-through” content. The thread concludes with a suggestion to consider using Discourse’s built-in parser or ProseMirror schema to handle such imports more systematically, especially for larger migrations. Thomas_Rother later clarifies that the jumping cursor issue doesn’t occur in the rich editor, only the old one.
I am currently moving some content from Dokuwiki (https://www.dokuwiki.org/dokuwiki) to Discourse. The Dokuwiki syntax is not clean markdown, therefore it needs manual editing. I normally use the old editor as I can see all characters there. But with the old editor I see strange “jumping effects”: when you mark a text block and try to format it, the cursor jumps up and down. Re-formatting of longer text is nearly impossible that way, as you always have to re-position your editing window again. It is hard to describe this, I could only show it with screencasts … The effect was describe earlier in Cursor jumping around in composer / editor text box
The RTE editor editor does not show this effect. But I am missing an option to clean up junky code imported from other systems …
If it’s more than a few, it probably makes sense to get an import script to do it. If it’s not that many, then it likely still would make sense to get some code to fix the markdown rather than trying to edit it by hand. (An even more wacky solution would be to have a plugin handle the docuwiki edditites).
Its not that many, but maybe enough, to think about a script-based/programatic solution. The tricky thing is that the code is dokuwiki syntax ( https://www.dokuwiki.org/wiki:syntax ) plus enhanced UI code from a bootstrap3 template (https://getbootstrap.com). It looks nice but I did not have content migration in mind when I’ve setted it up this way. The main issue is not the dokuwiki syntax, but the bootstrap
… stuff. Code example:
<div class="level1"> </div> <h2 class="page-header pb-3 mb-4 mt-5">Plattenplatz ermitteln</h2> <div class="level2"> <p>Filtern auf ext4, was ist verfügbar?</p> <pre class="code"> 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% - </pre> <p> </p> <p>Filtern auf ext4, was wird genutzt?</p> <pre class="code"> root@tokoeka ~ # df -h -t ext4 --output=used Used 39G 400M 560G 40K 598G </pre> <p> </p> </div>
If you paste a clipboard with this exact text/html content in rich editor mode you get a content resulting in this 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 (divs, classes, etc), but will understand hN, pre, or anything defined in our ProseMirror schema, respecting our various editor extensions registering parseDOM definitions used by ProseMirror’s parser, including those from theme components or plugins.
As for the original request:
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: