Dataface Tasks

Tasks server Jinja macro expansion for plans markdown

IDINFRA_TOOLING-TASKS_SERVER_JINJA_MACRO_EXPANSION_FOR_PLANS_MARKDOWN
Statuscompleted
Priorityp1
Milestonem1-ft-analytics-analyst-pilot
Ownersr-engineer-architect
Completed2026-03-23

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.py defines define_env for mkdocs-macros-plugin; implementations use Path(__file__).parent as the plans tree root.
  • tasks/mkdocs.yml extra.current_milestone drives 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_html only on /tasks/* doc route.

Plan

  1. tasks/tools/tasks_plans_jinja.py — load extra, TasksMacroEnv, expand_tasks_markdown_macros.
  2. tasks_server.tasks_page — expand then _markdown_body_to_html(..., trust_html=True).
  3. Tests: README integration + undefined macro.

Implementation Progress

  • Added tasks/tools/tasks_plans_jinja.py (TasksMacroEnv, load_mkdocs_extra, expand_tasks_markdown_macros via Jinja2 StrictUndefined).
  • 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_shell in test_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