You're probably looking for cmakebyexample.jcbhmr.com 😉
Make sure you've installed:
- CMake
- mdBook
- mdbook-cmdrun
- mdbook-codename
- clang-format
The custom theme/highlight.js
is needed because the default mdBook highlight.js
doesn't include the some languages. To regenerate a custom build of theme/highlight.js
use ./task.cmake generate
.
To create a new example ("Cool feature" in this example):
- Add it to
src/SUMMARY.md
like- [Cool feature](cool-feature/README.md)
. - Create a
src/cool-feature/README.md
. - Create your example in
src/cool-feature/
. Add a bunch of comments in the code files so that they are visible on the website and when viewing the file in an IDE. {{#include filename.txt}}
any interesting files insrc/cool-feature/README.md
.- Add any shell commands to interact with the example to the
src/cool-feature/README.md
. Make sure to document them. - (Optional) Use
<!-- cmdrun cmake ... -->
or similar inside a```
code block to run that command and use its output at build time. Remember to add--fresh
and--clean-first
to CMake commands so that the output is reproducable. Also addexec 2>&1 && ...
so that stderr is redirected to stdout (which is whatmdbook-cmdrun
captures). - Create a corresponding
.devcontainer/cool-feature/devcontainer.json
that will open the example's folder. Add any necessary dependencies to the dev container. - Add an "Open in Codespaces" button to the
src/cool-feature/README.md
.