Skip to content

Commit

Permalink
fix: Fix inline rendering beheavior
Browse files Browse the repository at this point in the history
  • Loading branch information
3y3 committed Aug 14, 2024
1 parent 7ada585 commit 60bdf22
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/transform/md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ function initCompiler(md: MarkdownIt, options: OptionsType, env: EnvType) {
const {needToSanitizeHtml = true, renderInline = false, sanitizeOptions} = options;

return (tokens: Token[]) => {
const html = renderInline
? md.renderer.renderInline(tokens, md.options, env)
: md.renderer.render(tokens, md.options, env);
if (renderInline) {
tokens = tokens.filter((token) => token.type === 'inline');
}

const html = md.renderer.render(tokens, md.options, env);

return needToSanitizeHtml ? sanitizeHtml(html, sanitizeOptions) : html;
};
Expand Down

0 comments on commit 60bdf22

Please sign in to comment.