Tasks server Jinja macro expansion for plans markdown
Problem
tasks/*.md still contained {{ current_milestone_card() }} and similar MkDocs macro calls; the tasks server showed them literally after MkDocs removal.
Context
tasks/macros.pydefinesdefine_envfor mkdocs-macros-plugin; implementations usePath(__file__).parentas the plans tree root.tasks/mkdocs.ymlextra.current_milestonedrives rollup scope.
Possible Solutions
- A — Full Jinja templates per page: heavy.
- B — Jinja pass on markdown body, then Markdown (recommended): reuse
define_env+ macro callables;trust_htmlonly on/tasks/*doc route.
Plan
tasks/tools/tasks_plans_jinja.py— loadextra,TasksMacroEnv,expand_tasks_markdown_macros.tasks_server.tasks_page— expand then_markdown_body_to_html(..., trust_html=True).- Tests: README integration + undefined macro.
Implementation Progress
- Added
tasks/tools/tasks_plans_jinja.py(TasksMacroEnv,load_mkdocs_extra,expand_tasks_markdown_macrosvia Jinja2StrictUndefined). tasks_server:_markdown_body_to_html(..., trust_html=);/tasks/{path}runs macro expansion before markdown.- Browse markdown unchanged (still escaped; no macro expansion).
- Tests:
tests/core/test_tasks_plans_jinja.py,test_tasks_readme_expands_macros_in_shellintest_tasks_server.py.
QA Exploration
-
N/A — covered by unit/integration tests;
/(plans hub) and legacy URL redirect HTML assertions. -
[x] QA exploration completed (or N/A for non-UI tasks)
Review Feedback
- [ ] Review cleared