Have you looked at the Lisps / Scheme / Racket yet? Racket in particular makes it quite nice to go #lang blah
at the top of the file and change the parsing or interpretation entirely.
For example all the documentation pages and guides are written in scribble:
https://docs.racket-lang.org/scribble/getting-started.html#(part._first-example)
#lang scribble/base
@title{On the Cookie-Eating Habits of Mice}
If you give a mouse a cookie, he's going to ask for a
glass of milk.
And it has an entire document markup language created in it, which can output pdf or html. But you can still use @ syntax to drop in racket code to compute values. Or create templates.
I even implemented a #lang which took assembly directly (and interpreted it, it was for a class).
So if you are really after full control, you should study Lisps and their macro systems.
Hmm spatial awareness? Left is code right is docs and if you have any other windows they don’t break that?