Skip to content

fix: html entities in the text node with any non-text node as siblings won't get encoded #376

@n0099

Description

@n0099

🐛 The bug

<!-- comment node -->
{{ title }}
{{ title }}
<p>element node</p>
{{ title }}
{{ title }}
<p>element node</p>
<!-- comment node -->
{{ title }}
{{ title }}

All of above will prevent chars in prop title get escaped as html entities.

<!-- comment node -->
<span>{{ title }}</span>
<span>{{ title }}</span>
<p>element node</p>

will be an workaround as span has only one text node as children.

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-starter-efdmceeo?file=components%2FOgImage%2FMyTemplate.vue

🌈 Expected behavior

Escape any chars that requires html entity in text node with any sibling which is not text node like what satori did.

ℹ️ Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions