This is a good example of what the OP is asking for. However, you really have to see an example of it to understand the benefits. The writers of the "Physically Based Rendering: From Theory to Implementation" did this for their book, and it's pretty amazing.
They would write text, then a code block:
func main() {
<main body variable declarations>
<main body functions>
}
followed by another block of text, and then an expansion of the code
<main body variable declarations> =
var foo int
var bar int64
And so on.
<main body variable declarations> +=
var zed rune
Which, when run through the "tangler", would produce:
func main () {
var foo int
var bar int64
var zed rune
}
The first really interesting implementation I've seen of literate programming, and it makes me want to implement it myself.