The recent query about documentation for the HashArray structure reminded me that a while ago I wrote a tool to enable an ML source file to contain documentation. The tool is based on Poly/ML's parser and parses the file, writing signature information to an XML file. The documentation itself is written as specially formatted comments.
I've used it to produce the documentation for the Poly/ML-specific modules in the basis library which aren't otherwise documented. The easiest way to understand it is probably to look at the source code for a module such as the Thread structure (e.g. https://github.com/polyml/polyml/blob/master/basis/Thread.sml ) and the output at https://polyml.org/documentation/Reference/Thread.xml .
The code is at https://github.com/polyml/polydoc . It may be useful for other projects and I'm open to suggestions for improvement.
David