Closed Bug 2068546 Opened 2 months ago Closed 2 months ago

Document Mermaid diagrams in the documentation skill

Categories

(Developer Infrastructure :: AI for Development, task)

task

Tracking

(firefox157 fixed)

RESOLVED FIXED
157 Branch
Tracking Status
firefox157 --- fixed

People

(Reporter: dao, Assigned: dao)

References

(Blocks 2 open bugs)

Details

Attachments

(1 external file)

docs/conf.py enables sphinxcontrib.mermaid, so a mermaid block is a supported way to draw a diagram in firefox-source-docs, but the documentation skill says nothing about them: not layout, not arrow labels, not color. Each of the following cost time while adding two flowcharts to browser/components/sessionstore/docs/events.md (bug 2066123), so they are gotchas with a case behind them rather than a reading of the mermaid source:

  • A mermaid block always builds, since Sphinx only emits the source into a <pre class="mermaid ..."> and the browser renders it from a CDN at load time. ./mach doc succeeding says nothing about the diagram, and every failure below is invisible until the built page is opened.
  • Mermaid emits <svg style="max-width: <intrinsic>px" width="100%"> and the Read the Docs body column is about 700px wide, so a wider diagram is scaled down proportionally: at 1800px intrinsic the text renders at about 40% and is unreadable. flowchart LR and sequenceDiagram reach that with eight participants carrying Firefox-length names, so flowchart TD is the default and the fix is the layout rather than the font size.
  • A label containing an unbroken word of about 25 characters or more renders as an empty box in Firefox (mermaid#5785). A wrappingWidth: 400 frontmatter config block works around it.
  • A label starting with 1. is parsed as markdown and renders as the literal text Unsupported markdown: list. A colon instead of the period avoids it.
  • Distinguishing two kinds of node by fill color alone fails for a colorblind reader and on a low-quality display, so vary the shape too: the stadium (["text"]) reads clearly against ["text"], while the rounded rectangle ("text") has only a 5px radius. classDef takes rx/ry for an intermediate radius, but only with a CSS unit -- rx:14 is emitted into the style attribute and silently ignored, rx:14px applies.
  • Directive options must be contiguous, immediately after the opening fence: a blank line between :align: and :caption: ends the option block, and the stray :caption: line then renders as diagram source.

Bug 2068532 inserts an "API references from source comments" section immediately before "Best Practices", which is the natural spot for this one too, so whichever lands second rebases.

Both copies of the skill have to stay identical; ./mach lint -l agent-skills-sync --fix mirrors them.

See Also: → 2068556
Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED
Pushed by dgottwald@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/9d04bc308341 https://hg.mozilla.org/integration/autoland/rev/9d37628b0afa Document mermaid diagrams in the documentation skill. r=ai4dev-reviewers,padenot DONTBUILD
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 157 Branch
Blocks: 2071162
Blocks: 2071266
See Also: → sessionstore-docs
See Also: sessionstore-docs →
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: