Tangle is a JavaScript library for creating reactive documents. Your readers can interactively explore possibilities, play with parameters, and see the document update immediately. Tangle is super-simple and easy to learn.
via worrydream.com
This is really interesting: add "variables" to your text that can be changed by the user, while the rest of the text changes accordingly. I just think that it's too uncoupled, requiring you to write an HTML template and add Javascript code; it would be better if the initialization and update where written directly in the template. Maybe it's possible and I haven't found out.
At one time I wanted to develop a presentation app that worked like this. Graphs would have a legend describing them, and changing the legend would update the graph. This could be used for presentations written in HTML (which is how I do them these days, anyway).