Skip to content

custom tag and html built-in tag are rendered inconsistently #758

Closed

Description

@mantou132

example:

<gbp-example
title="dy-avatar-group">

</gbp-example>


<details
title="dy-avatar-group">

</details>

current render result:

<p><gbp-example
title="dy-avatar-group"></p>
</gbp-example>
<details
title="dy-avatar-group">
</details>

Custom elements must have a closing tag, so rendering should be equivalent to <details>.

Activity

  1. jgm commented on Dec 13, 2023

    @jgm
    Member

    gbp-example is not recognized as a block-level tag, so this is parsed as raw inline HTML. As inline content, it gets put in a paragraph. Of course that's not what you intended, but it's in accord with the spec.

    Since this is a custom tag, there's simply no way to know whether it's intended as inline or block level content.

    Your best bet is to change the input a bit so that you have a type 7 raw HTML block. For this, the whole tag has to be on a line, followed by end of line.

    <gbp-example title="dy-avatar-group">
    
    </gbp-example>
    

    You say:

    Custom elements must have a closing tag.

    Perhaps your thought is that we could defer classification of the element until we've finished the paragraph -- if we haven't hit a matching closing tag, we can take it as block-level.

    I think that's too fancy, and it goes against our aim of being able to discern block-level content on a line-by-line basis.

  2. mantou132 commented on Dec 13, 2023

    @mantou132
    Author

    Thank you for your explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions