Welcome to Codidact Meta!
Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.
Although div tag is not allowed, it's rendered in the preview
tl;dr
According to this post, the div
tag is not allowed, thus it's removed from posts. But it's not removed from the preview, and I believe both (the preview and the final saved post) should be consistent between each other.
I've made this test on the dev server, using HTML that contains a div
.
In the post editor, I've used this HTML:
<div dir="rtl">abc...</div>
I'm using dir="rtl"
because it gives a good visual hint that the div
is there, as we can see in the images below.
In the preview, the div
is rendered:
We can see the div
is there in the preview, by checking the browser's console, and also by noting that dir="rtl"
was applied (text is using right-to-left direction).
But when I save the post, the div
is removed:
We can see that by checking the browser's console, and also noting that right-to-left is no longer being applied (which confirms that the tag was removed).
This is not a feature request to add support for div
. It's a bug report about the inconsistency between the preview and the final rendered post. If a tag is removed from the saved post, the preview should remove it as well.
I believe that both should render everything the same way, whenever it's possible. This would avoid situations where an user thinks their HTML will work, but will find out it doesn't work only after saving the post.
One interesting detail: if you try to edit the test post in dev server, you'll notice that the div
is still there. So it wasn't actually removed from the markdown text, it's just not rendered in the final HTML.
PS: I've also tested with kbd
and the same happens (it's rendered in the preview, and removed after saving the post). I haven't tested with other tags.
1 comment thread