File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
packages/site-kit/src/lib/markdown Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -260,10 +260,20 @@ async function parse({
260
260
let current = '' ;
261
261
262
262
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 ) ;
265
273
} ,
266
- heading ( { text, depth, raw } ) {
274
+ heading ( { tokens, depth, raw } ) {
275
+ const text = this . parser ! . parseInline ( tokens ) ;
276
+
267
277
const title = text
268
278
. replace ( / < \/ ? c o d e > / g, '' )
269
279
. replace ( / & q u o t ; / g, '"' )
You can’t perform that action at this time.
0 commit comments