Skip to content

WIP : generate the docs for the builtin element based on comments in builtins.slint#11356

Draft
ogoffart wants to merge 7 commits intomasterfrom
olivier/builtins-docs-generator
Draft

WIP : generate the docs for the builtin element based on comments in builtins.slint#11356
ogoffart wants to merge 7 commits intomasterfrom
olivier/builtins-docs-generator

Conversation

@ogoffart
Copy link
Copy Markdown
Member

Part of #104

The goal here is to make sure there is less inconsistency in the documentation.
Use /// for normal documentation comment and //! for "section" documentation or documentation of property that are not in the builtins.slint

The Text of the documentation should be unchanged (modulo bug)

This PR still contain the generated files, at this point, so we see them in the diff. But Before merging that we should remove the generated files from the git tree.

Comment thread internal/compiler/builtins.slint Outdated
Comment on lines +677 to +679
/// <CodeSnippetMD imagePath="/src/assets/generated/rectangle-example.png" imageAlt='rectangle example'>
/// ```slint playground
/// export component ExampleRectangle inherits Window {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to replace the <CodeSnippetMD ...> with

```slint playground imageAlt="rectangle example" width="320" height="420"

Comment thread internal/compiler/builtins.slint Outdated
component Empty {
//! ## Common Visual Properties
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this back into common.mdx instead of extracting it.

The doc generator emits inherited properties first, then the element's
own properties.  Reorder the hand-written mdx files so that they already
follow this order, to minimize the diff when the generator takes over.
Move the enum/struct/keys mdx generation from xtask/slintdocs and
the screenshot generation from tools/docsnapper into a single new
tool at docs/slint-doc-generator with subcommands:
  generate-mdx, screenshots, build-astro.
Running without a subcommand generates mdx, screenshots, and
builds astro. Update CI workflows and READMEs.
…lint.

Instead of writing <CodeSnippetMD> XML tags in doc comments, screenshot
attributes are now placed directly on the code fence info string:

    /// ```slint playground imageAlt="example" width="200" height="200"

The doc generator transforms these into <CodeSnippetMD> wrappers with
auto-generated numbered image paths (e.g. rectangle-1.png, rectangle-2.png).
@ogoffart ogoffart force-pushed the olivier/builtins-docs-generator branch from d8a651e to 0e6fa68 Compare April 17, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants