The chm compiler and compilelatexchm.pp in fpcdoc/ repo resp use fasthtml and fcl-xml's sax_html
How to use fasthtml?, I cannot see it in the package list and online package manager
That's because it's not a package on its own... it's a unit. See fpc/packages/chm/src/fasthtmlparser.pas. Example usage is in fpc/packages/chm/src/htmlindexer.pas.
It's not a DOM parser though, as you requested. It signals events for tags and text. It does not build a DOM tree.