Skip to content

Preserve indent inside unclosed inline HTML attributes - #312

Open
mamicicekel wants to merge 1 commit into
commonmark:masterfrom
mamicicekel:preserve-inline-html-attr-indent
Open

mamicicekel wants to merge 1 commit into
commonmark:masterfrom
mamicicekel:preserve-inline-html-attr-indent

Conversation

@mamicicekel

Copy link
Copy Markdown

Summary

Paragraph continuation lines skip leading indentation before the inline parser runs. That is correct for ordinary text, but it also rewrites raw HTML that spans lines. A tag such as

<a class="abc
    d  e f">text</a>

was parsed as class="abc\nd e f", which changes the attribute. Block HTML already keeps the spaces.

addLine now restores the skipped indent when the paragraph still ends inside an unclosed HTML tag, comment, PI, declaration, or CDATA section. Ordinary paragraph indent is unchanged.

Fixes #303.

Test plan

Made with Cursor

Paragraph indent stripping was applied before the inline parser, so a
newline inside a raw HTML tag dropped spaces that change the attribute
value. Keep that indent when the paragraph is still inside an unclosed
tag.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

White space handling looks inconsistent between HTML block element vs HTML inline element

1 participant