I agree markdown is not great for documentation. I'm writing a little site generator for my blog and after exploring a a lot of different options I decided to come up with my own format!<p>XML is a great way to write structured documentation. It is the best option for "mixed content", that is, content that has character data, optionally interspersed with structured elements. The problem is that most standard XML documentation formats (docbook, dita, etc.) are heavy and most times overkill. I'm using RelaxNG [2] to create a schema of my custom format document [2], and a bit of XSLT3 [3] to generate HTML5.<p>RelaxNG is great, and pretty easy to use. You can think of it as a "regular expression over trees". The syntax is pretty intuitive, specially the compact form (there's an XML form too). For instance:<p><pre><code> start = element doc {
attribute title { text } ?,
element p { text } *
}
</code></pre>
... defines the schema for a document that should have a "doc" root tag, an optional title attribute, and 0 or more "p" elements, that should contain only text.<p>The way I went about it, I'm just inspiring my format in a small subset of HTML5, plus some tags that I want to use to provide more structured information.<p>XSLT 3.0 came a long way since the version 1.0 that everybody remembers and loathes. Now, XSLT3 has maps, arrays, functions, higher order functions, and all sort of other goodies that people have come to expect from a modern programming language. Yeah, you still need to get pass the XML syntax, but it is not a big deal once you get the hang of it.<p>Finally, writing XML "by hand" is not a big deal neither. I'm using Emacs with the nxml and emmet [4] package, and I just needed to learn a few keystrokes for doing things like automatically closing tags. Emmet is amazing and fun to use to create small chunks of content at a time.<p>1: <a href="https://en.wikipedia.org/wiki/RELAX_NG" rel="nofollow">https://en.wikipedia.org/wiki/RELAX_NG</a><p>2: <a href="https://gist.github.com/EmmanuelOga/39ddb345c2a499690e728e5908e942f2" rel="nofollow">https://gist.github.com/EmmanuelOga/39ddb345c2a499690e728e59...</a><p>3: <a href="https://stackoverflow.com/tags/xslt-3.0/info" rel="nofollow">https://stackoverflow.com/tags/xslt-3.0/info</a><p>4: <a href="https://emmet.io/" rel="nofollow">https://emmet.io/</a>