Skip to content

mkdocs dialect: drop GFM linkify from the goldmark profile #34

Description

@jbeda

Follow-up to #30 (the ask-goldmark span rewrite, now on main). The design already commits to this — docs/design.md, Dialects section — but it was deliberately deferred to its own session rather than ridden along with the core.

What

Under --dialect mkdocs, the goldmark configuration should drop the extension.Linkify extension. Python-Markdown (the mkdocs target renderer) has no GFM autolinking, so a bare URL is plain prose there. Because #30 made the span computation and the render backstop both read from the profile's goldmark config, dropping linkify makes bare URLs automatically stop being treated as autolinks under this dialect — no per-dialect guard logic anywhere.

Dropping linkify cannot split a URL in any mode: every break candidate is a whitespace run and a bare URL contains none, so reflow only moves the whitespace around the token. The only behavior linkify governs in span computation is code-span pairing around a backtick inside a bare URL — near-nonexistent in real prose.

Where the profile choice has to reach

  • internal/gm.New (document parse) — format.go, internal/render/render.go, and reflow's line reparse (internal/reflow/reflow.go).
  • internal/gm.NewInline (the no-break span profile) — internal/segment/nobreak_gm.go.
  • internal/render.Normalized (the render backstop comparison must use the same profile).
  • segment.NoBreakSpans / segment.CodeSpans — currently take only text string and are called from ~7 sites in reflow.go with no dialect parameter.

Suggested precursor

Do the design's "compute no-break spans once per cluster and share them" refactor first (design.md, "No-break spans: ask goldmark" — the cost/sharing note). That collapses the ~7 recomputing call sites into one, so the dialect/profile choice threads to a single place instead of spreading a new parameter across the segment API.

Verification

Our render backstop only measures self-consistency under goldmark's semantics; it cannot see goldmark-vs-Python-Markdown divergence. The real oracle for this change is a full mkdocs build diff on a real docset (Karl Isenberg's workflow). Land it when that verification is available.

Also note #26: deriveOptions never exercises the mkdocs dialect (hash bits 16/17 free), so the fuzzer does not currently cover mkdocs at all — worth wiring up alongside this so the profile split gets fuzz coverage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions