Skip to content

Roadmap items 13, 18, 20: root docs_dir, Jinja env in on_page_context, markdown_extensions_path - #143

Merged
shenxianpeng merged 4 commits into
mainfrom
claude/project-thread-r8fi8v
Nov 2, 2026
Merged

shenxianpeng merged 4 commits into
mainfrom
claude/project-thread-r8fi8v

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Three small roadmap items, one commit each.

#18: on_page_context can get the Jinja environment. Handlers that take an env keyword (or **kwargs) now get the environment that renders the page. Other handlers are called exactly as before. The check uses the handler's signature and is cached. BasePlugin.on_page_context's signature is unchanged, so typed plugins don't get mypy override errors. The docstring documents the new keyword.

#20: markdown_extensions_path. This new setting takes a list of directories, relative to mkdocs.yml. They are added to sys.path before markdown_extensions is validated, so a project-specific extension can live next to the docs:

markdown_extensions_path: [extensions]
markdown_extensions: [abbreviations]

Each directory must exist. A path is added only once, so mkdocs serve rebuilds don't stack duplicates. The JSON Schema is regenerated.

#13: the project root as docs_dir. docs_dir: . is now allowed. get_files skips the config file and the site_dir. It also skips the site_dir set in mkdocs.yml when a command builds somewhere else (mkdocs serve builds into a temporary directory), so a site built earlier doesn't turn into docs. As a result, a site_dir inside the docs_dir is allowed too. A docs_dir inside the site_dir is still an error.

Related Issue

Roadmap #59, items 13, 18 and 20.

Checklist

  • New tests added for new behavior (if applicable)
  • Documentation updated (if applicable): configuration guide, on_page_context docstring, upstream-issues page
  • Release notes docs/about/release-notes.md updated (if applicable)

Checks run locally: unit tests (985 OK), prek, mypy, integration builds, and a strict build of the docs. I also built real sites end to end: one with a local extension, and one with docs_dir: . built twice, which gives no nested site/ and no mkdocs.yml in the output.

Handlers with an `env` keyword (or **kwargs) now receive the Jinja
environment that renders the page. Other handlers are called exactly as
before, so existing plugins keep working.
The listed directories are added to sys.path before markdown_extensions
is validated, so small project-specific extensions can live next to the
docs without PYTHONPATH or a package.
docs_dir may now be the directory of mkdocs.yml. The config file and the
site_dir are left out of the docs, also the configured site_dir when a
command builds elsewhere (mkdocs serve). A site_dir inside the docs_dir
is therefore allowed too; the docs_dir inside the site_dir is still an
error.
On PyPy, builtins such as max have a signature, so the test now uses an
object whose __signature__ makes inspect.signature raise.
@codspeed

codspeed Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 29 untouched benchmarks


Comparing claude/project-thread-r8fi8v (b00d701) with main (732f152)

Open in CodSpeed

@shenxianpeng
shenxianpeng merged commit 447547c into main Nov 2, 2026
24 checks passed
@shenxianpeng
shenxianpeng deleted the claude/project-thread-r8fi8v branch November 2, 2026 08:32
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