Skip to content

Commit

Permalink
feat(plugin-markdown-hint): add inline rendering support for title (#274
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pengzhanbo authored Oct 12, 2024
1 parent 63f3e5a commit 7ea981f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugins/markdown/plugin-markdown-hint/src/node/hint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export const hint: PluginWithOptions<MarkdownItHintOptions> = (

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
info = options[localePath]?.[name]
} else {
info = md.renderInline(info)
}

return `<div class="hint-container ${name}">\n<p class="hint-container-title">${
info || name
}</p>\n`
return `<div class="hint-container ${name}">\n<p class="hint-container-title">${info || name}</p>\n`
},
closeRender: () => '</div>\n',
})
Expand All @@ -70,6 +70,8 @@ export const hint: PluginWithOptions<MarkdownItHintOptions> = (

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
info = options[localePath]?.caution
} else {
info = md.renderInline(info)
}

return `<div class="hint-container caution">\n<p class="hint-container-title">${
Expand Down Expand Up @@ -101,6 +103,8 @@ export const hint: PluginWithOptions<MarkdownItHintOptions> = (

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
info = options[localePath]?.details
} else {
info = md.renderInline(info)
}

return `<details class="hint-container details"><summary>${
Expand Down

0 comments on commit 7ea981f

Please sign in to comment.