Turning markdown into html

How do I turn markdown into html in an Obsidian plugin? If that’s not already built in, what is the library Obsidian uses to convert markdown? I kinda need this for the plugin I’m currently making.

you are probably looking for this function: https://github.com/obsidianmd/obsidian-api/blob/39efa39de0b3b51c52d5ac9a92bd19de396a9d3a/obsidian.d.ts#L1830

Be careful if the markdown is not supplied by the user.
This will run all registered post processors.

So if for example there is a code block inside the markdown,
and a plugin(Dataview for example) is installed, the code will be run.

It works! Thanks dude! Another question if you don’t mind, registerMarkdownPostProcessor() doesn’t seem to work for me but it’s a little vague on how it’s supposed to work. I tried the guide here Markdown post processing | Obsidian Plugin Developer Docs it does work with the code block version however.

what do you mean with does not work?
Where did you try it?(Reading mode/live preview/source mode)

A MarkdownPostProcessor only works in reading mode.

Aha, I only use the live preview mode. I’m guessing there’s no alternative?

To do stuff in Live preview/source mode you need a CodeMirror 6 decoration.
It’s a bit more complicated.

here is a reference plugin: https://github.com/nothingislost/obsidian-cm6-attributes

If you are planning on releasing your plugin you should write both a Post Processor and a decoration.

I’m probably gonna keep it within code blocks, they seem to be a little simpler and are good enough for what I want.