From af1b6301dc395587d6a5de981de19998d235d36a Mon Sep 17 00:00:00 2001 From: TheNorthMemory <1631685+TheNorthMemory@users.noreply.github.com> Date: Sun, 11 Aug 2024 23:58:34 +0800 Subject: [PATCH] fix(markdown/plugins/containers): use `Token.attrJoin` for rendering additonal className --- src/node/markdown/plugins/containers.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/node/markdown/plugins/containers.ts b/src/node/markdown/plugins/containers.ts index 99973bb295b7..c7a9e2d4f666 100644 --- a/src/node/markdown/plugins/containers.ts +++ b/src/node/markdown/plugins/containers.ts @@ -64,15 +64,16 @@ function createContainer( { render(tokens, idx, _options, env: MarkdownEnv & { references?: any }) { const token = tokens[idx] - const info = token.info.trim().slice(klass.length).trim() - const attrs = md.renderer.renderAttrs(token) if (token.nesting === 1) { + token.attrJoin('class', `${klass} custom-block`) + const attrs = md.renderer.renderAttrs(token) + const info = token.info.trim().slice(klass.length).trim() const title = md.renderInline(info || defaultTitle, { references: env.references }) if (klass === 'details') - return `
${title}\n` - return `

${title}

\n` + return `
${title}\n` + return `

${title}

\n` } else return klass === 'details' ? `
\n` : `
\n` } }