MARKDOWN_HELP_PAGE_CONTEXT

MarkdownHelp: page-context awareness + backfill missing directives

Current state

MarkdownHelp.vue (client/src/components/Markdown/MarkdownHelp.vue) is a single hand-written component with a binary mode: DirectiveMode prop where DirectiveMode = "page" | "report" (client/src/components/Markdown/directives.ts:3). It is mounted in exactly one place — the GModal inside MarkdownEditor.vue (client/src/components/Markdown/MarkdownEditor.vue:38-44) — and the title flips on the same boolean ("Markdown Help for Pages" vs "Markdown Help for Invocation Reports"). Two callers drive the prop: PageEditorView.vue:61 hard-codes markdownEditorMode = "page" for both standalone and history-attached pages, and Workflow/Editor/Index.vue:125 hard-codes mode="report". So after the notebooks/reports unification, “history page” and “standalone page” collapse to the same mode="page" help — exactly the original concern. The history-page assistant context is never wired in.

The PR-era diff (git log 4afd63a9a9 -- client/src/components/Markdown/MarkdownHelp.vue) only changed a type import and one wording tweak (“resulting Galaxy Page” → “resulting document”). Help content is otherwise inherited unchanged from the pre-unification era and has not absorbed history-context knowledge.

Concrete gaps

  1. Widen DirectiveMode and thread real context through (S). Files: directives.ts, MarkdownHelp.vue, MarkdownEditor.vue, PageEditorView.vue, directives.yml. Change DirectiveMode to "page_standalone" | "page_history" | "report" or keep "page" and add a sibling historyAttached: boolean prop (less churn). PageEditorView.vue:61 already knows via editorMode / isStandalone; pass that through. directiveEntry() already does per-mode lookup so YAML additions are localized.
  2. Backfill missing directives in the help (S). Files: MarkdownHelp.vue, directives.yml. Drive the DirectiveHelpSection directive lists from VALID_ARGUMENTS (or a curated subset) instead of three hand-written arrays. At minimum add inline-capable directives (history_dataset_name, history_dataset_type, workflow_license, generate_time, generate_galaxy_version, instance_*), history_dataset_embedded, history_dataset_index, history_dataset_link, invocation_inputs, invocation_outputs, history_link, visualization. Mark inline-capable ones with a badge fed by EMBED_CAPABLE_DIRECTIVES.
  3. Document inline syntax and HID/ID resolution for history pages (XS). Files: MarkdownHelp.vue, directives.yml. Add a short “Inline references” section with a ${galaxy history_dataset_name(history_dataset_id=...)} example, and — when context is history-attached — a short blurb that the AI chat panel can resolve HIDs and pick IDs for you. Reuse phrasing from lib/galaxy/agents/prompts/page_assistant.md:55-68.
  4. Single source of truth for directive metadata (M, out of scope for this issue). Move the directive catalog (name, description, help, embed-capable, valid args) into a server-served JSON sourced from markdown_parse.py, so directives.yml, MarkdownToolBox, MarkdownHelp, and the agent prompt cannot drift. Real tech debt; punt until there’s a second drift incident.

Also: fix the stray > typo at MarkdownHelp.vue:110 while you’re in there.

Scope for this issue

Items 1 + 2 + 3 + typo. Probably an afternoon. Item 4 is mentioned as out-of-scope for future work.

References