brrd / abricotine

Markdown editor with inline preview
GNU General Public License v3.0
2.63k stars 159 forks source link

Character sequence <a> breaks inline preview #313

Closed fmonteghetti closed 2 years ago

fmonteghetti commented 2 years ago

First of all, thanks for this outstanding Markdown editor! I have noticed a minor issue that I think is worth reporting.

Issue description The character sequence <a> leads to inline preview breaking down. (The same issue occurs with <a). I noticed the issue by opening a file with many command lines (not HTML tags). This is minor, but I report it since this does not happen with Typora or Mark Text, which are other Markdown editors with live preview.

Steps to reproduce To reproduce the issue, open the attached file 'abricotine-bug.md'. On my system, any code after <a> is not previewed, see the attached screen capture. Note that, in the screen capture, the outline panel (displayed on the left) does display 'Section' and 'Sub-section' as expected, which seems to indicate that the Markdown code after <a> is parsed correctly.

abricotine-bug.md abricotine-bug

Additional info Abricotine v1.0.0 downloaded from official website. Fedora 35 with kernel 5.14.18-300.fc35.x86_64. GNOME 41.1.

Workaround A straightforward workaround is to enclose the problematic sequence in a Code Block.

brrd commented 2 years ago

This behavior comes from CodeMirror markdown mode and I'm afraid it is not a bug but a feature. Markdown syntax supports inline HTML, so if you open any tag such as <a> or <hello> (which is a valid tag in HTML 5) the following characters will be parsed as HTML.

You can either wrap this text in a code block or an inline code span (delimited with ` characters) or use &lt;, which is the HTML escape sequence for <.