Skip Navigation

[Tip] Remove traditional Markdown styling generated with the Markdown plugin

This is a trick I've stumbled upon several days ago, and I haven't seen it documented anywhere in the examples or advanced tutorial page. If you don't feel like the traditional Markdown style when using the Markdown plugin and simply wanted to use the usual HTML style, you can simply do this:

markdown = {import:markdown-plugin}

output = [markdown(text).replace("markdown-body", "")]

The .replace("markdown-body", "") part is what makes the formatted text loses the Markdown style and goes into the regular HTML style which then you can stylize yourself using CSS to whatever you want. It essentially removes the markdown-body class in the body of the entire markdown text (or that's what I could explain).

1
1 comments
  • There is an alternative approach without using the [markdown(...).replace(...)] method, you simply put this at the very bottom of the HTML panel:

    [[...document.querySelectorAll(".markdown-body")].forEach(x=>x.classList.remove("markdown-body")), ""]
    

    What it basically does is that it removes all the markdown-body class from all the markdown body texts that have it. This is ideal for those who have multiple [markdown(...)] calls in one generator.