vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.29k stars 2.15k forks source link

fix(markdown/plugins/containers): use `Token.attrJoin` for rendering additional className #4128

Open TheNorthMemory opened 3 months ago

TheNorthMemory commented 3 months ago

Description

while there is an additional css className, for eg: .my-class onto the custom containers, vitepress is crashed with sth like:

11:19:56 PM [vitepress] Internal server error: Duplicate attribute.

The markdown content like below,

::: info {.my-class id=test}
hello
:::

Using the Token.attrJoin method is solved this problem, rendering as below:

<div class="my-class info custom-block" id="test">
  <p class="custom-block-title">INFO</p>
  <p>hello</p>
</div>

Linked Issues

Additional Context


[!TIP] The author of this PR can publish a preview release by commenting /publish below.