Add make target to generate doc for internal API
Add a new module abstracting file writing

Instead of writing directly to disk, backend should return a list of
filepaths and content. This is good for several reasons:
- it makes testing easier
- it makes it easier to implement "output options" on a generic level
  (like change the output directory or printing a diff with existing
  files)
- it makes the code purer