HTML Tags not closing with markdown extension #1598
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the issue
HTML Tags are not closing automatically with
markdown()extension.<div>seems to work fine, and closes automatically.But trying other elements like
<b>,<a>,<label>, etc. does not work, unless a<div></div>is present above.Reproduction steps:
<b>, notice how doesn't auto-close<b>and enter<div>,<div>auto-closes successfully<div></div>and enter<b>again, this time auto-close is successful for<b>https://github.com/user-attachments/assets/359379bf-2428-4c64-8f51-d016f951747b
Browser and platform
Chrome
Reproduction link
https://codemirror.net/try/#c=aW1wb3J0IHsgYmFzaWNTZXR1cCwgRWRpdG9yVmlldyB9IGZyb20gImNvZGVtaXJyb3IiCmltcG9ydCB7IG1hcmtkb3duIH0gZnJvbSAiQGNvZGVtaXJyb3IvbGFuZy1tYXJrZG93biIKCmxldCB2aWV3ID0gbmV3IEVkaXRvclZpZXcoewogIGRvYzogIiIsCiAgZXh0ZW5zaW9uczogWwogICAgYmFzaWNTZXR1cCwKICAgIG1hcmtkb3duKCksCiAgXSwKICBwYXJlbnQ6IGRvY3VtZW50LmJvZHkKfSk=
What's happening is that the Markdown parser isn't yet parsing
<bas an HTML tag, whereas it is<div(or<por any block tag). As such, HTML-specific behavior like the auto-closing isn't firing when a>is typed. This parsing behavior matches the CommonMark spec (compare this and this example), but I agree that the outcome isn't great in this situation.It seems kind of hard to work around, though. The closing logic is implemented with an input handler, which runs before the
>is in the document (and thus in the parse).