refactor: Strip site-specific framing from docgen templates#210
Merged
Conversation
Consumers of `flagsmith docgen {events,metrics}` previously got a page
with a hard-coded Flagsmith-shaped header — frontmatter, intro prose,
and a section heading. The opentelemetry link in the events header
turned out to be a relative URL that only resolved correctly when the
events page happened to live where the library author put it; moves in
the consumer's docs tree silently broke it.
Strip both templates to pure data (just the event / metric entries),
letting consumers own the page header via their own MDX or a concat
step. Regenerate snapshots.
BREAKING CHANGE: consumers of `docgen events` / `docgen metrics` must
now supply their own page header (frontmatter + intro) when wiring the
output into their docs site.
beep boop
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
=======================================
Coverage 97.26% 97.26%
=======================================
Files 104 104
Lines 4459 4459
=======================================
Hits 4337 4337
Misses 122 122 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
khvn26
added a commit
to Flagsmith/flagsmith
that referenced
this pull request
Apr 20, 2026
…artial The flagsmith-common docgen templates used to emit a full Docusaurus page — frontmatter, intro prose, a section heading, and the catalogue entries. The intro links and framing were necessarily site-specific, which meant upstream owned URLs that only made sense for one consumer and silently broke on docs-tree moves (see Flagsmith/flagsmith-common#210). Switch to an MDX + partial pattern. The `docgen events` and `docgen metrics` commands now write only the catalogue entries to underscore-prefixed partial files (`_events-catalogue.md`, `_metrics-catalogue.md`) — Docusaurus ignores these from routing. The page shell moves to hand-authored `events.mdx` and `metrics.mdx` that import the partials, owning the frontmatter, intro prose, and internal links. Pins flagsmith-common to the PR branch temporarily; swap for a version pin once that lands and releases. beep boop
4 tasks
khvn26
added a commit
to Flagsmith/flagsmith
that referenced
this pull request
Apr 20, 2026
Switch back from the PR branch pin now that Flagsmith/flagsmith-common#210 (pure-data docgen templates) has been released. beep boop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to #201
Strip both
docgen-events.mdanddocgen-metrics.mddown to pure catalogue data. Consumers offlagsmith docgen {events,metrics}previously got a full page with hard-coded framing — frontmatter, intro prose, and a section heading. The OpenTelemetry link in the events header turned out to be a relative URL that only resolved correctly when the events page happened to live where the library author had put it; any move in the consumer's docs tree silently broke it.The templates now emit only the per-event / per-metric
### ...entries. Consumers supply their own frontmatter and intro — either by writing an MDX page that imports the generated fragment as a partial, or by concatenating a hand-maintained header before the docgen output in their build.BREAKING CHANGE
Consumers of
docgen events/docgen metricsmust now supply their own page header. The generated file alone is no longer a publishable docs page.For the MDX partial pattern, rename the output to an underscore-prefixed file (Docusaurus treats
_foo.mdas a non-routed partial) and import it from a hand-authored.mdx:Then in your Makefile:
How did you test this code?
Regenerated the two snapshot fixtures (
test_docgen__events__runs_expected.txt,test_docgen__metrics__runs_expected.txt) viapytest --snapshot-update, then ran the tests normally to confirm they pass.