Skip to content

Commit fa46e81

Browse files
committed
fix
1 parent 1011958 commit fa46e81

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

packages/site-kit/src/lib/markdown/renderer.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,20 @@ async function parse({
260260
let current = '';
261261

262262
return await transform(body, {
263-
text({ text }) {
264-
return smart_quotes(text);
263+
text(token) {
264+
// @ts-expect-error I think this is a bug in marked — some text tokens have children,
265+
// but that's not reflected in the types. In these cases we can't just use `token.tokens`
266+
// because that will result in e.g. `<code>` elements not being generated
267+
if (token.tokens) {
268+
// @ts-expect-error
269+
return this.parser!.parseInline(token.tokens);
270+
}
271+
272+
return smart_quotes(token.text);
265273
},
266-
heading({ text, depth, raw }) {
274+
heading({ tokens, depth, raw }) {
275+
const text = this.parser!.parseInline(tokens);
276+
267277
const title = text
268278
.replace(/<\/?code>/g, '')
269279
.replace(/&quot;/g, '"')

0 commit comments

Comments
 (0)