+@if (Model.HasInlineStory)
+{
+
+
+}
+else
+{
+
+}
+ @if (Model.HasBody)
+ {
+
+ @Model.RenderBlock()
+
+ }
+
diff --git a/src/Elastic.Markdown/Myst/Directives/Storybook/StorybookViewModel.cs b/src/Elastic.Markdown/Myst/Directives/Storybook/StorybookViewModel.cs
new file mode 100644
index 0000000000..f201bcf75e
--- /dev/null
+++ b/src/Elastic.Markdown/Myst/Directives/Storybook/StorybookViewModel.cs
@@ -0,0 +1,26 @@
+// Licensed to Elasticsearch B.V under one or more agreements.
+// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
+// See the LICENSE file in the project root for more information
+
+namespace Elastic.Markdown.Myst.Directives.Storybook;
+
+public class StorybookViewModel : DirectiveViewModel
+{
+ public required string StoryUrl { get; init; }
+
+ public required string StoryId { get; init; }
+
+ public required int Height { get; init; }
+
+ public required string IframeTitle { get; init; }
+
+ public bool HasBody { get; init; }
+
+ public string? InlineEntry { get; init; }
+
+ public string? InlineBootstrapJson { get; init; }
+
+ public bool HasInlineStory => !string.IsNullOrWhiteSpace(InlineEntry);
+
+ public string HeightStyle => $"{Height}px";
+}
diff --git a/src/Elastic.Markdown/Myst/Renderers/LlmMarkdown/LlmBlockRenderers.cs b/src/Elastic.Markdown/Myst/Renderers/LlmMarkdown/LlmBlockRenderers.cs
index 25002d5bed..7290376891 100644
--- a/src/Elastic.Markdown/Myst/Renderers/LlmMarkdown/LlmBlockRenderers.cs
+++ b/src/Elastic.Markdown/Myst/Renderers/LlmMarkdown/LlmBlockRenderers.cs
@@ -15,6 +15,7 @@
using Elastic.Markdown.Myst.Directives.Include;
using Elastic.Markdown.Myst.Directives.Math;
using Elastic.Markdown.Myst.Directives.Settings;
+using Elastic.Markdown.Myst.Directives.Storybook;
using Markdig.Extensions.DefinitionLists;
using Markdig.Extensions.Tables;
using Markdig.Extensions.Yaml;
@@ -496,6 +497,9 @@ protected override void Write(LlmMarkdownRenderer renderer, DirectiveBlock obj)
case AgentSkillBlock agentSkillBlock:
WriteAgentSkillBlock(renderer, agentSkillBlock);
return;
+ case StorybookBlock storybookBlock:
+ WriteStorybookBlock(renderer, storybookBlock);
+ return;
}
// Ensure single empty line before directive
@@ -864,6 +868,28 @@ private static void WriteAgentSkillBlock(LlmMarkdownRenderer renderer, AgentSkil
renderer.EnsureLine();
}
+ private static void WriteStorybookBlock(LlmMarkdownRenderer renderer, StorybookBlock block)
+ {
+ if (string.IsNullOrEmpty(block.StoryUrl))
+ return;
+
+ renderer.EnsureBlockSpacing();
+ renderer.Writer.Write("