maizzle / framework

Quickly build HTML emails with Tailwind CSS.
https://maizzle.com
MIT License
1.23k stars 49 forks source link

The `&` character is escaped to `&` in the components' propsContext. #1370

Closed Leon2xiaowu closed 5 days ago

Leon2xiaowu commented 5 days ago

Hi, when installing the latest @maizzle/framework, the & symbol is also escaped to &.

This occurs within the components' propsContext.

<!-- components/tttt.heml -->
<script props>
  module.exports = {
    href: props.xx || '#',
  }
</script>

<a xx="{{ href }}">
  <content />
</a>
<!-- use component -->
<x-tttt xx="adjfakasdf&asdkldja"></x-tttt>
<!-- build result -->
<a xx="adjfakasdf&amp;asdkldja"></a>

If I nest multiple components, the & character will be escaped more than once.

<!-- components/tttt.heml -->
<script props>
  module.exports = {
    href: props.xx || '#',
  }
</script>

<a>
  <x-tttt1 xx="{{ href }}">
    <content />
  </x-tttt1>
</a>
<a xx="adjfakasdf&amp;amp;asdkldja" ttt1="true"></a>

here are my dependencies

  /@maizzle/framework@4.8.9:
    resolution: {integrity: sha512-giZnOXYIzqdxDj1/mH18Qq8v0yrx5CUrEBNBVK81H1FxuRcqgL89Mzev+EAMEhHJ7equRdInhisNzNizeW08hg==}
    engines: {node: '>=14.0.0'}
    hasBin: true
    dependencies:
      '@maizzle/cli': 1.5.9
      autoprefixer: 10.4.20(postcss@8.4.47)
      browser-sync: 3.0.3
      color-shorthand-hex-to-six-digit: 3.1.0
      email-comb: 5.3.1
      fast-glob: 3.3.2
      front-matter: 4.0.2
      fs-extra: 11.2.0
      html-crush: 4.2.0
      is-url-superb: 5.0.0
      juice: 10.0.1
      lodash: 4.17.21
      ora: 5.4.1
      postcss: 8.4.47
      postcss-import: 15.1.0(postcss@8.4.47)
      postcss-merge-longhand: 6.0.5(postcss@8.4.47)
      posthtml: 0.16.6
      posthtml-attrs-parser: 1.1.1
      posthtml-base-url: 2.0.2
      posthtml-component: 1.1.1
      posthtml-content: 2.1.0
      posthtml-extend: 0.6.5
      posthtml-extra-attributes: 2.0.0(posthtml@0.16.6)
      posthtml-fetch: 3.0.0
      posthtml-markdownit: 3.1.0
      posthtml-match-helper: 1.0.4(posthtml@0.16.6)
      posthtml-mso: 3.1.0
      posthtml-postcss-merge-longhand: 3.1.2
      posthtml-safe-class-names: 3.0.0
      posthtml-url-parameters: 2.1.0
      pretty: 2.0.0
      query-string: 7.1.3
      string-remove-widows: 2.1.0
      string-strip-html: 8.5.0
      tailwindcss: 3.4.10
    transitivePeerDependencies:
      - bufferutil
      - debug
      - encoding
      - supports-color
      - ts-node
      - typescript
      - utf-8-validate
      - zen-observable
      - zenObservable
    dev: false
cossssmin commented 5 days ago

Use triple braces to prevent escaping:

- {{ href }}
+ {{{ href }}}