fix: handle references in container titles

closes #3004
pull/3005/head
Divyansh Singh 1 year ago
parent 0d56855b54
commit 7fbfe71b6c

@ -38,12 +38,12 @@ function createContainer(
container, container,
klass, klass,
{ {
render(tokens, idx) { render(tokens, idx, _options, env) {
const token = tokens[idx] const token = tokens[idx]
const info = token.info.trim().slice(klass.length).trim() const info = token.info.trim().slice(klass.length).trim()
const attrs = md.renderer.renderAttrs(token) const attrs = md.renderer.renderAttrs(token)
if (token.nesting === 1) { if (token.nesting === 1) {
const title = md.renderInline(info || defaultTitle) const title = md.renderInline(info || defaultTitle, { ...env })
if (klass === 'details') if (klass === 'details')
return `<details class="${klass} custom-block"${attrs}><summary>${title}</summary>\n` return `<details class="${klass} custom-block"${attrs}><summary>${title}</summary>\n`
return `<div class="${klass} custom-block"${attrs}><p class="custom-block-title">${title}</p>\n` return `<div class="${klass} custom-block"${attrs}><p class="custom-block-title">${title}</p>\n`

Loading…
Cancel
Save