Rich text editor erases HTML tags from post

If you use the markdown editor and include some raw HTML tags (e.g. br tag for table formatting), then edit the post using the rich text editor, the HTML content is lost. I don’t know if this is the case for all allowed HTML tags, but at the very least it happens for br tags. This may not be a big deal for regular posts since most users presumably stick with one type of editor, but for wiki posts this is a major issue. Over on WaniKani, we have a massive wiki post with several tables that rely on br tags for structure. However, if someone happens to edit the wiki in rich text mode, all br tags are removed, ruining the formatting of the post.

(Secondarily, there doesn’t seem to be an easy way to revert to a previous version of the wiki. If that was available, at least some of this pain would be mitigated. I can write up a feature request for that as well if the feature doesn’t already exist.)


Markdown editor:

Rich text editor:

2 Likes

Use this post to see what I mean. I don’t think I can make this post a wiki myself, but admins/mods should be able to try it. (If not, it’s easy to reproduce.)

Column 1 Column 2
Text 1a
Text1b
Text 3a
Text3b
Text 2a
Text2b
Text 4a
Text4b
3 Likes

Confirmed this is a bug in our table editor, the content in cells is considered inline, but really we would need to treat it as a type of block to keep the <br> mapping going.

@renato any thoughts here, it is an edge case, but I agree it would be nice to support it.

2 Likes

Just to confirm, by table editor do you mean specifically the table editor popup or some edit logic for tables in the general post editor? Because I’m referring to the post editor itself.

post editor … rich text editor does not support this at the moment, there is no workaround for it.

1 Like

Would it be viable to at least detect these situations and disable the RTE?

I much prefer to fix it, I really dislike the hack of disabling the composer, totally get how it happened that we introduced it in the past, but I do not think we need to reach to it here

I have another example that is not inside of tables. You can use a span tag with a lang attribute to differentiate Japanese and Chinese fonts. This also seems to be lost when switching from markdown to rich text editor. Interestingly, the big tag is retained.

1 Like

Any update on this issue?

1 Like

I have a fix here:

Also does ruby and span with lang

Entering Ruby in the rich editor is still going to be tricky, once it is there it is fine, but getting it there is not easy. That said the features are now more complete post this change.

@renato can you have a look?

3 Likes

Fix is merged :confetti_ball: enjoy

3 Likes

Thank you for the quick turnaround!

Roughly when should I expect it to show up on https://community.wanikani.com? I want to let everyone know when it’ll be safe to edit the tables with the rich text editor. According to the source, it’s currently on 2026.1.0-latest, commit f8f53ac5e8e4348ae308fcddc078766463d5e5f3 which is three weeks old.

1 Like

Right after upgrading?

As a customer of Discourse hosting, you cannot update it yourself, so I think asking them when that is going to happen is legitimate.

1 Like

This topic was automatically closed after 20 hours. New replies are no longer allowed.

Shoot of an email to team@discourse.org :hugs:

1 Like