diff --git a/src/util/mdUtil.ts b/src/util/mdUtil.ts index dd4c54f..9105f24 100644 --- a/src/util/mdUtil.ts +++ b/src/util/mdUtil.ts @@ -26,9 +26,16 @@ const turndownService = new TurndownService({ export const mdToHtml = (markdown: string) => { - return md.render(markdown); + if (!markdown) return markdown; + const html = md.render(markdown).trim(); + if (html.startsWith("

") && html.endsWith("

")) { + return html.substring(3, html.length - 4); + } + return html; } + export const htmlToMd = (html: string) => { + if (!html) return html; return turndownService.turndown(html) }