Markdown in Blender's text editor and UI

I definitely need a better title for this thread, but oh well…

I was looking if there was any kind of way to use markdown in Blender, more specifically at least to have syntax highlight in the text editor, if not having a final format preview, or some hybrid like some markdown editors do.
And additionally, I was also wondering if there is a way to also inject some UI from a markdown based text. I.E. I was thinking, sometimes I make my own rig UI via python, but having a text file on the side is annoying and disconnected, and inserting texts and explanations with Blender’s bpy is… annyoing to code for the dev. But if I could have a simple way to just write a piece of markdown code somewhere and have it displayed in one slingshot, that’d be nice.

And that’s where I found this:

It looks like, this piece of .py allows to do basically what I was searching for the UI itself.

I’m not an expert in python, but from what I understand, it’s just a matter of importing blender_markdown.py, declaring the raw markdown content as a string in a variable, then displaying it with blender_markdown.py’s display function which itelf reuses normal bpy stuff to format the Markdown into blender labels and whatnot.

I was wondering, anyone knows if this could be possibly used with the text editor somehow? I.E. make an addon that adds a button in the text editor and toggles between raw markdown to formatted markdown?

That code is 90% of it, I’ve encountered it before and tried making it into an add-on but ran in some difficulties :thinking: I don’t remember what they were, maybe I’ll give it another go if no one else does

Well, next time i’m stuck waiting for work i’ll give it a try :o

It definitely needed an update for the newer BPY, but now at least it works:

blender_markdown.py (5.0 KB)

Now it doesn’t support links, bold/italic, and the headers level are only shown by how many dots are placed below them. It’s very limited, but maybe someone with more knowledge than me can do something.