Skip to content

Add more features to doc code example extractor #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

SidneyCogdill
Copy link
Contributor

@SidneyCogdill SidneyCogdill commented May 19, 2025

Changes:

  1. Multiple codeblocks within ## Example section is now supported.
  2. Replaced the regular expression based solution with a stateful parser. This makes it capable of handling more complex markdown documentations.
  3. Each doc page now generates a corresponding CMake target in its own subdirectory.
  4. Implemented a template mechanism for CMakeLists.txt generation. The C++ module example makes use of this mechanism to correctly add CXX_MODULES file set.
  5. Only changed files are updated when re-running the generator, by first generating in a temporary directory and then moving only the modified files. This makes incremental builds much faster, since only the actually changed codes (extracted from docs) require recompiling.

Although this is feature complete, I'm marking this as draft, as it's a fairly large change (it almost completely rewrote the old script).

Note this has a few changes since I've wrote it in #293.

@SidneyCogdill
Copy link
Contributor Author

btw indented code blocks aren't handled:


- Code 1:

  ```
  Hi
  ```

- Code 2:

  ```
  There
  ```

This is how it's rendered in GitHub:


  • Code 1:

    Hi
    
  • Code 2:

    There
    

They're not hard to implement, but currently there seems to be no use case for that within docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant