diff --git a/src/util/html.js b/src/util/html.js index 9a2d013..d65e575 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -65,8 +65,8 @@ function whenYouWalking(tree, images = true, embed = true) { alt != null ? ` "${alt}"` : "" })`; } - } else if (elem.b) { - str += `**${whenYouWalking(elem.b, images, embed)}**`; + } else if (elem.b || elem.h4 || elem.h5 || elem.h6) { + str += `**${whenYouWalking(elem.b ?? elem.h4 ?? elem.h5 ?? elem.h6, images, embed)}**`; } else if (elem.blockquote) { str += `> ${whenYouWalking(elem.blockquote, images, embed).replaceAll(/\n/g, "\n> ")}`; } else if (elem.br) { @@ -75,10 +75,14 @@ function whenYouWalking(tree, images = true, embed = true) { str += `\`${whenYouWalking(elem.code, images, embed)}\``; } else if (elem.dd) { str += `\u3000\u3000${whenYouWalking(elem.dd, images, embed).replaceAll(/\n/g, "\n\u3000\u3000")}`; - } else if (elem.em) { - str += `_${whenYouWalking(elem.em, images, embed)}_`; - } else if (elem.i) { - str += `_${whenYouWalking(elem.i, images, embed)}_`; + } else if (elem.em || elem.i) { + str += `_${whenYouWalking(elem.em ?? elem.i, images, embed)}_`; + } else if (elem.h1) { + str += `# ${whenYouWalking(elem.h1, images, embed)}`; + } else if (elem.h2) { + str += `## ${whenYouWalking(elem.h2, images, embed)}`; + } else if (elem.h3) { + str += `### ${whenYouWalking(elem.h3, images, embed)}`; } else if (elem.img && images) { const link = elem.$src ?? elem[":@"]?.$src; const alt = elem.$alt ?? elem.$title ?? elem[":@"]?.$alt ?? elem[":@"]?.$title;