docs: inject example headings dynamically from pyproject.toml metadata#6544
Merged
Conversation
Replace static ### headers before <CodeExample> blocks with a Docusaurus remark plugin (remark-inject-example-headings) that reads titles from examples-metadata.json at build time. The metadata generator (generate.py) now includes the title from [tool.flet.metadata] in each example's entry. Running in beforeDefaultRemarkPlugins so injected headings are picked up by Docusaurus TOC extraction. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous pass only covered website/docs/controls/*.md; this extends it to subdirectories (ads, colorpickers, camera, etc.) by switching to rglob. Also fixes the script itself to use rglob for future runs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends the scan from website/docs/controls/ to all of website/docs/ so types/, services/, tutorials/, and cookbook/ are covered too. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…chart headings Add [tool.flet.metadata].description to 6 chart examples (matplotlib bar chart, toolbar, plotly line/bar/pie/box). The remark plugin now injects a description paragraph after the heading when the metadata has one. Static ### headers and description paragraphs removed from matplotlibchart.md, matplotlibchartwithtoolbar.md, and plotlychart.md so they no longer duplicate the injected content. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… headings Add multi-paragraph descriptions with inline-code links to assist_chips and filter_chips pyproject.toml files. Remove static ### headers and description paragraphs from chip.md. Upgrades the remark plugin's inline parser to handle [`code`](url) links and multi-paragraph descriptions (blank-line separated). Keeps hasPrecedingH3 as a safety net for any remaining static ### headers in other docs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add descriptions for infinite_scrolling and programmatic_scroll examples. Also correct titles from verbose "Column infinite scrolling" / "Column programmatic scroll" to the shorter "Infinite scrolling" / "Scrolling programmatically" used as section headings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Nested themes 1 -> "Inherited and overridden theme" Nested themes 2 -> "Page, dark and light themes" Nested themes 3 -> "Theme mode toggle" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mples Inject the same CodeExample blocks from cupertinoalertdialog.md directly instead of linking to that page's Examples section. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add titles and descriptions for spacing, adaptive_row_heights, and sortable_and_selectable examples. Title for spacing updated to "Horizontal margin and column spacing" and sortable_and_selectable to "Sortable columns and selectable rows" to match the former static headers. Static ### headers and descriptions removed from datatable/index.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace 'see these' links with inline CodeExample blocks matching datatable/index.md. The remark plugin will inject headings and descriptions from pyproject.toml automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ach); update title in pyproject.toml dismissible.md uses a static ### header with rich description (admonition, blockquote, bold text) which is complex to express in plain TOML strings. The pyproject.toml title is still set for gallery use; hasPrecedingH3 in the remark plugin skips auto-injection for this example. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…y_title=false in pyproject.toml Title injection is now on by default for all examples. Set display_title=false in [tool.flet.metadata] to suppress injection for a specific example (used by dismissible/remove_on_dismiss_declarative which has a hand-written heading with rich description in the doc page). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the inline Examples sections from DataCell, DataColumn, and DataRow docs (deleted multiple CodeExample/Image blocks), leaving only the ClassAll component. Also remove a redundant "### CodeEditor" heading from the CodeEditor page. This cleans up duplicated example content and relies on centralized/example assets elsewhere.
- draggable.md: uncomment CodeExample blocks, remove static ### header - dragtarget.md: replace 'see these' link with inline CodeExample blocks, add examples/example_images frontmatter, switch ClassAll to ClassSummary+ClassMembers so description appears above examples Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ct.toml, inject from metadata Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… pyproject.toml, inject from metadata Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…l, inject from metadata Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…m metadata - Extend remark plugin to handle hardcoded CodeExample paths (not just frontMatter.examples + '/subfolder/') via HARDCODED_PATH_RE - Move title+description to adaptive_navigation/pyproject.toml - Remove static ### header and description from navigationbar/index.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ect from metadata Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t from metadata Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…etadata Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…data Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace inline backtick reference with a Sphinx cross-reference (:class:`~flet.Radio`) in RadioGroup docstring to improve documentation linking. Remove the redundant "Examples" section from the radiogroup docs page to clean up generated docs; no behavioral changes.
…, inject title from metadata Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gin for [`code`][ref_id] links - Remove all static ### headers and descriptions from video/index.md - Add descriptions (with API cross-references) to all 8 video example pyproject.toml files - Extend remark plugin parseInline to handle [`code`][ref_id] pattern by emitting the text+inlineCode+text triplet that remark-api-links expects for link resolution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nject from metadata
Convert hardcoded path="..." to path={'...'} so HARDCODED_PATH_RE in the
remark plugin can resolve the metadata key and inject the title.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Sorry @InesaFitsner, your pull request is larger than the review limit of 150000 diff characters
Static headers have been cleaned up; remark plugin handles injection going forward. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Renames the [tool.flet.metadata] field from `description` to `docs_intro` across all 32 pyproject.toml files, updates the generate.py reader and remark-inject-example-headings plugin accordingly, and regenerates the examples-metadata.json. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…le> tag
Instead of reading display_title from [tool.flet.metadata] and storing
displayTitle in examples-metadata.json, the remark plugin now reads a
displayTitle={false} JSX attribute directly from the <CodeExample> element.
Applied to the dismissible remove_on_dismiss_declarative example.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| [tool.flet.metadata] | ||
| title = "Featured views" | ||
| title = "Managed views — full app with NavigationRail" | ||
| docs_intro = "Complete app with [NavigationRail](../controls/navigationrail), stacked project views, and tabbed settings — all using `manage_views=True`." |
Contributor
There was a problem hiding this comment.
try using [flet.NavigationRail] or (../controls/navigationrail.md).
…intro Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, not flat file) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
FeodorFitsner
approved these changes
Jun 3, 2026
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.
Description
Adds a beforeDefaultRemarkPlugins remark plugin that injects ### headings (and optional descriptions) before each at build time, sourcing content from [tool.flet.metadata] in each example's pyproject.toml
Extends crocodocs generator to include title, description, and displayTitle in the examples metadata JSON
Removes all static ### headers and inline description paragraphs from doc pages across controls/, types/, services/ — injected dynamically instead
TOC entries work correctly (plugin runs in beforeDefaultRemarkPlugins, before Docusaurus's built-in TOC extraction)
Supports display_title = false opt-out for examples with hand-written headings
Handles [code][api_ref_id] cross-references in descriptions (compatible with remark-api-links)
Injects inline examples replacing "see these/this" links in DataCell, DataRow, DataColumn, CupertinoDialogAction, DragTarget, ReorderableListView
Test code
# Minimal test/reproduction code for reviewers, if applicable.Type of change
Checklist
website/sidebars.ymlfor breaking changes, removals, and deprecations, if applicable.Screenshots
Additional details