I actually prototyped something similar a long time ago. It allowed for authoring sections that could be composed into a number of views. The only difference is that I wanted to capture the different "facets" of an article as well - so you could have a tab that was just the code, or statistics, etc.
You could possibly prototype with a coda template:
https://coda.io/@michael-joseph-rosenthal/essayist