I also do literate programming (write code as if it's a book written for your future self) with this exact same approach. Just write a two line script that removes everything that's not between ```python ``` and you can code inside Obsidian. (E.g. you can use a markdown parser like `marko` for python) I personally don't need syntax highlighting, but if you do, you can open it in your IDE/Emacs/etc and IDE should highlight most languages in Markdown files. You obviously don't get all the IDE bells and whistles, for those you can have separate files and import them in, or enable Python mode in markdown files (somehow). (Obsidian should support basic syntax highlighting for most common languages anyway)
Since Obsidian is so awesome, this approach has endless possibilities. E.g. you can do project management inside Obsidian via Kanban board, you can use Excalidraw tool in Obsidian to draw architecture diagrams, write music inside Obsidian with its Lilypond plugin, write math with LaTeX plugin etc. It just automatically works out of the box.
As an example, let's say you tagged every time a character is mentioned (will be done automatically as well with 'untagged references' for proper names). Or you have all of your backstory and timelines in sections that are linked to your writing, but you can output the finished writing without all of those links in there. So as an author you get a full timeline with metadata. You can also use additional tools for research with Obsidian plugins, including Zotero for academic references, Markdownload Browser Extension for shooting MD and images straight into your vault, git plugins inside Obsidian, etc.
Sorry I'm rambling, but absolutely go look at it again!
https://dave.autonoma.ca/blog/2019/05/22/typesetting-markdow...
Or the editor I wrote for this very purpose:
https://keenwrite.com/screenshots.html
The last screenshot shows a single source file having multiple themes applied, one being a manuscript theme.
The editor integrates variables in an external file so that if I want to change a character's name, I can do so in one place. Even diagrams (e.g., family tree) are updated.
I sometimes use Git branches to explore different story ideas but I mostly just use the system for basic versioning and history. I also use Git for written roleplays to store my logs and thoughts, and since MD is basically text I can use Unix tools like grep and wc.