At the moment I think some more "brainstorming" would be better. (I
don't mind moving this off the list, however I think it's better to
have this discussion open, as perhaps other authors could contribute
their view.)
BTW, the IETF has just gone through a similar approach by moving RFC's
from plain text to an XML-based format:
https://xml2rfc.tools.ietf.org/
Perhaps we could just reuse their tools? (They are / will be better
maintained than anything we can come up with.)