approvals / ApprovalTests.cpp

Native ApprovalTests for C++ on Linux, Mac and Windows
https://approvaltestscpp.readthedocs.io/en/latest/
Apache License 2.0
312 stars 51 forks source link

Investigate moving to in-place documentation snippets #158

Closed claremacrae closed 3 years ago

claremacrae commented 3 years ago

See https://github.com/simonCropp/MarkdownSnippets#inplaceoverwrite

This would mean that we would remove the *.source.md files, and put snippets directly in to .md files.

The main thing making this hard at the moment is the complex set of CMake rules I created to generate the to detect dependencies for the targets RunMdsnippets, Doxygen and Sphinx.

After removing .source.md files, it would no longer be feasible to work out whether the docs needed regenerating, without scanning all the .md files to see if they container any snippets, and then finding those snippets in source code, and seeing if the code had been changed.

So it would be easier to just remove all that CMake complexity - and make it so that those docs-specific targets just always run, without checking dependencies.

claremacrae commented 3 years ago

This SO answer shows how to force a custom command to always run.

claremacrae commented 3 years ago

I've simplified the CMakeLists.txt files in doc/ considerably, so these should not be a blocker to moving away from .source.md files now.

Another issue to investigate is whether any of the code in doc/sphinx/markdown_conversion.py needs to be updated.

claremacrae commented 3 years ago
claremacrae commented 3 years ago

I've now merged this to the main branch.

A side-benefit of this work is that it detected that the Sphinx docs had wrongly started containing the mdsnippets-generated tables of contents, due to a case-change in the endtoc end-marker...

Now, mdsnippets also gets run on the test input file doc/sphinx/tests/test_markdown_conversion_input.md - meaning that anyone running the sphinx python tests should notice if mdsnippets output is changed in a way that affects the output of doc/sphinx/markdown_conversion.py