WYSIWYG error on line breaks in raw HTML
See original GitHub issueDescription
When a hard line break is inserted using raw HTML ( <br>
or <br/>
tag ), the line break is rendered, but the <br>
tag is always displayed, even when the line is not anymore edited!
This is particularly annoying in Markdown table cells where the only way to add explicit line breaks is to use raw HTML.
- [] Can you reproduce the issue? [x]
Example
Line 1<br>Line 2
Expected behavior:
Line 1 Line 2
Actual behavior:
Line 1<br> Line 2
Versions
- Mark Text: 1.5.1
- Operating system: Ubuntu 18.04.3
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Item2174: WysiwygPlugin removes line breaks - Foswiki
WysiwygPlugin (I presume) removes line breaks from the middle of paragraphs. Being OCD, I like to put in line breaks at sentence (and...
Read more >Preserve white space line breaks in tinymce wysiwyg editor
But, when I edit the same data with tinymce editor, the tinymce editor puts all the data in one line. The original text...
Read more >Suggestion for "Convert line breaks into HTML" and text editor ...
So, should I: use wysiwyg editor and untick Convert line breaks into HTML ? or use Bueditor and tick Convert line breaks into...
Read more >line breaks not working [#205659] | Drupal.org
Found this is a CSS issue in FCKeditor, not an input filter issue. When I changed the setting for "Editor CSS:" from theme...
Read more >Linebreaks after tables in RoboHelp HTML WYSIWYG A... - Adobe ...
Can you select the line break in the WYSIWYG and then go into the HTML. There take an image of the selected markup...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The
<br>
is the “technical” artifact used to express the content. It is not the content! Outside of editing actions, it shall not be displayed.The
<br>
is only required when editing. Like any Markdown syntax or any other hardcoded HTML tag, It is not the content to be rendered. The content to be rendered is a line break. More generally, an HTML tag is an artifact used to express content, but not the content itself (especially in a WYSIWIG environment)By example, why
a <b>bold</b> text
is (correctly) rendered as “a bold text” (and not as “a <b>bold</b> text”) ?<b>
and</b>
tags describes a content, exactly like the<br>
tag for, same reasons. Saying that<b>
is content, and that<br>
is not, is not consistent at all.I don’t understand how you can say that
<br>
is content and<b>
is not. They serve the same purpose. They are the syntax sugar used to describe the content. They are not the content by itself. Displaying them outside of editing actions does not make any sense, and is just annoying when you expect a WYSIWIG rendering.For me, the
<br>
tag meaning and rendering is equivalent to a hard line break. So I don’t understand why you compare it to a soft line break in your last comment. In the source code, you can add a soft break if you want for convenience (except in tables), but there is no required line break at all (no soft or hard break).In your example, it should be rendered as:
<br>
tag: when it is edited, or viewed in source code mode.To understand the problem of
<br>
rendering, keep in mind that there is a place where you can only use<br>
tags: inside tables. Without this case, the problem of the<br>
is not important because a<br>
tag can always be replaced by a hard line break. But inside tables, you cannot use a hard line break, but only the<br>
tag. Seeing it rendred as<br>
brokes everything and there is no workaround. It is a nightmare. The WYSIWYG aspect of the tool is totally broken in this case.Try to render this in Mark Text to see the problem created by the
<br>
tags:More generally, any HTML tag supported by CommonMark must be displayed only when the line is edited, or permanently in source code mode. It should be rendered as expected (HTML rendering) when it is displayed in the WYSIWYG mode. Exactly like any other Markdown syntax element, no more no less. It is a strong and simple rule that is easy to understand and defend. My opinion is that changing the rules for some cases (like
<br>
) for obscure reasons has no sense and just brings confusion and troubles.<br>
should be rendered as a line break in WYSIWIG view mode for only one reason: it is a CommonMark supported HTML tag, so it should be rendered like any other supported element. Soft line break or hard-line breaks considerations can’t change anything to this. It does not matter compared to this strong fact.