[storybook] PoC of Storybook directive, for inline stories#2910
Open
clintandrewhall wants to merge 1 commit intomainfrom
Open
[storybook] PoC of Storybook directive, for inline stories#2910clintandrewhall wants to merge 1 commit intomainfrom
clintandrewhall wants to merge 1 commit intomainfrom
Conversation
🔍 Preview links for changed docs |
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.
Summary
This PR is a proof-of-concept for embedding Kibana Storybook stories in
docs-builderoutput, so teams can render interactive component examples directly inside product documentation.The immediate problem we are trying to solve is that Storybook content today lives separately from our docs experience. We want a path where Kibana documentation can reference Storybook stories, have those stories render inside docs pages, and eventually support a workflow where Storybook-authored documentation can be previewed and published through the same docs system.
This implementation is intentionally early and exploratory. It was heavily AI-assisted to help move quickly on the shape of the integration, and I expect parts of the API and implementation to change based on review feedback, Kibana-side needs, and production deployment constraints.
Note
This PR was written with extensive assistance from GPT-5.4.
Approach
Rather than teaching
docs-builderto understand Storybook MDX directly, this POC adds a first-classstorybookdirective to the markdown engine and treats that as the stable contract.That means the current architecture is:
docs-builderconsumes that markdown via a{storybook}directive.This keeps
docs-builderfocused on rendering and validation, while leaving repo-specific Storybook MDX interpretation to Kibana if we choose to build that transform.What’s Included
New
storybookdirectiveAdds support for:
:::{storybook} :id: components-button--primary :title: Button / Primary story :::or, when needed:
:::{storybook} :root: /storybook/kibana-eui :id: components-button--primary :height: 320 :title: Button / Primary story :::The directive renders an iframe in HTML output and a structured
<storybook ...>element in LLM markdown output.Docset-level Storybook configuration
Adds
storybookconfig indocset.ymlso authors do not need to repeat the root on every story block.Supported settings now include:
This supports a few use cases:
storybook.rootstorybook.server_rootstorybook.allowed_rootsURL generation and validation
The directive now builds the iframe URL internally as:
Validation ensures that:
iframe.html, query strings, and fragments are rejected in:root:/is supported as the root of the Storybook serverDocumentation and testing notes
Adds and updates documentation for:
This is meant to make review easier and give the team a concrete starting point for trying the flow from Kibana.
Why this shape
The main design choice in this POC is that
docs-builderunderstands a normalized Storybook embed contract, not Storybook MDX itself.That gives us a cleaner separation of concerns:
docs-builderowns markdown parsing, validation, rendering, and docs-site outputThat feels like the right boundary for now, especially since Storybook MDX resolution is repo-specific and may vary by package, build system, or authoring conventions.
Notes / Caveats
/storybook/<library>/.Feedback I’m Looking For
docs-builder/ Kibana responsibility split the right one?storybook.root+server_rootthe right docset-level model?