Level 4 β Contributor¶
Time: ongoing
You'll understand the architecture, run the full test suite, and make your first contribution.
What you'll learn¶
- How the codebase is organized
- How to run the development environment
- How the test harnesses work
- How to make and verify a change
- How to open a PR
Prerequisites¶
- Completed Level 3 β Customizer
- Git installed
- GitHub account
Step 1 β Fork and clone¶
# Fork on GitHub, then:
git clone https://github.com/your-username/mkdocs-void.git
cd mkdocs-void
pip install -e .
npm install
Step 2 β Understand the architecture¶
Read Architecture for the full picture. The key files:
| File | What it does |
|---|---|
void/plugins/void_plugin.py |
MkDocs plugin β config defaults, hooks, SW generation |
void/templates/base.html |
Root HTML template |
void/templates/assets/javascripts/void.js |
All client-side behavior (5500+ lines) |
void/templates/assets/stylesheets/ |
SCSS source (tokens + components) |
tools/build.js |
SCSS β CSS build pipeline |
tools/check_docs.py |
Doc lint (8 checks) |
tests/void.test.js |
JS smoke tests (55 checks) |
Step 3 β Run the dev environment¶
Edit SCSS in void/templates/assets/stylesheets/ β changes rebuild
automatically. Edit void.js β reload the browser.
Step 4 β Run the full test suite¶
# JS smoke tests
npm test
# Doc lint
python tools/check_docs.py
# Strict build
mkdocs build --strict --clean
All three must pass before opening a PR.
Step 5 β Make a change¶
Pick a good first issue or
create a small improvement:
- Create a branch:
-
Make your change.
-
Run the checks:
- If you changed plugin config, regenerate the reference:
- Commit with a Conventional Commit prefix:
Step 6 β Open a PR¶
- Push your branch:
-
Open a pull request against
main. -
Fill in the PR template:
-
What changed and why
- Screenshot for visual changes
-
Checklist:
mkdocs build --clean,npm test,check_docs.pyall pass -
Wait for CI to go green.
Testing recipes¶
Adding a new init function¶
- Write the function in
void.js. - Call it from the boot IIFE.
- Add a smoke test in
tests/void.test.js:
const myBoot = bootIIFE({
location: { origin: "https://x", pathname: "/page/", search: "", href: "https://x/page/", hash: "" },
config: { base: "/", components: {}, content: {}, void_search: { enabled: false }, translations: {} },
searchDom: null,
stored: {},
})
check("my feature boots without throwing", myBoot)
- Run
npm test.
Adding a new config key¶
- Add the default in
void/plugins/void_plugin.py(_VOID_DEFAULT_*). - Add the key to
_VOID_TOKEN_MAP. - Run
python tools/emit_config_reference.py. - Document the key in the relevant docs page.
- Run
python tools/check_docs.py.
Adding a new doc page¶
- Create the
.mdfile indocs/. - Add the nav entry in
mkdocs.yml. - Run
python tools/check_docs.pyβ the nav sync check confirms it's wired.
Verify you got it¶
- Forked and cloned the repo
-
npm testpasses (55/55) -
python tools/check_docs.pypasses (8/8) -
mkdocs build --strictbuilds clean - Made a change and verified it locally
- Opened a PR with a Conventional Commit title
- CI is green