-

+ @if (!string.IsNullOrEmpty(diagram.LocalSvgUrl))
+ {
+

+ }
+ else
+ {
+

+ }
}
else
diff --git a/src/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cs b/src/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cs
index 4c8a6e2d6..4a04c6f86 100644
--- a/src/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cs
+++ b/src/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cs
@@ -294,8 +294,16 @@ private static void WriteIncludeBlock(HtmlRenderer renderer, IncludeBlock block)
var snippet = block.Build.ReadFileSystem.FileInfo.New(block.IncludePath);
var parentPath = block.Context.MarkdownParentPath ?? block.Context.MarkdownSourcePath;
- var document = MarkdownParser.ParseSnippetAsync(block.Build, block.Context, snippet, parentPath, block.Context.YamlFrontMatter, default)
- .GetAwaiter().GetResult();
+ var state = new ParserState(block.Build)
+ {
+ MarkdownSourcePath = snippet,
+ YamlFrontMatter = block.Context.YamlFrontMatter,
+ DocumentationFileLookup = block.Context.DocumentationFileLookup,
+ CrossLinkResolver = block.Context.CrossLinkResolver,
+ ParentMarkdownPath = parentPath,
+ DiagramRegistry = block.Context.DiagramRegistry
+ };
+ var document = MarkdownParser.ParseSnippetAsync(snippet, state, Cancel.None).GetAwaiter().GetResult();
var html = document.ToHtml(MarkdownParser.Pipeline);
_ = renderer.Write(html);
@@ -330,7 +338,15 @@ private static void WriteSettingsBlock(HtmlRenderer renderer, SettingsBlock bloc
SettingsCollection = settings,
RenderMarkdown = s =>
{
- var document = MarkdownParser.ParseMarkdownStringAsync(block.Build, block.Context, s, block.IncludeFrom, block.Context.YamlFrontMatter, MarkdownParser.Pipeline);
+ var state = new ParserState(block.Build)
+ {
+ MarkdownSourcePath = block.IncludeFrom,
+ YamlFrontMatter = block.Context.YamlFrontMatter,
+ DocumentationFileLookup = block.Context.DocumentationFileLookup,
+ CrossLinkResolver = block.Context.CrossLinkResolver,
+ DiagramRegistry = block.Context.DiagramRegistry
+ };
+ var document = MarkdownParser.ParseMarkdownString(s, MarkdownParser.Pipeline, state);
var html = document.ToHtml(MarkdownParser.Pipeline);
return html;
}
diff --git a/src/Elastic.Markdown/Myst/MarkdownParser.cs b/src/Elastic.Markdown/Myst/MarkdownParser.cs
index f5e01bd21..7272591c7 100644
--- a/src/Elastic.Markdown/Myst/MarkdownParser.cs
+++ b/src/Elastic.Markdown/Myst/MarkdownParser.cs
@@ -5,6 +5,7 @@
using System.IO.Abstractions;
using Cysharp.IO;
using Elastic.Documentation.Configuration;
+using Elastic.Documentation.Configuration.Diagram;
using Elastic.Markdown.Helpers;
using Elastic.Markdown.Myst.CodeBlocks;
using Elastic.Markdown.Myst.Comments;
@@ -24,7 +25,7 @@
namespace Elastic.Markdown.Myst;
-public partial class MarkdownParser(BuildContext build, IParserResolvers resolvers)
+public partial class MarkdownParser(BuildContext build, IParserResolvers resolvers, DiagramRegistry diagramRegistry)
{
private BuildContext Build { get; } = build;
public IParserResolvers Resolvers { get; } = resolvers;
@@ -45,30 +46,37 @@ private Task