I recommend reading up on cweb and its history. The tangling and weaving metadata and prose lives in the code with special fenced blocks. Noweb is a modern version of it:
https://github.com/nrnrnr/noweb (but it's not really used or maintained much anymore)