diff --git a/Examples/SwiftStreamingMarkdownSample/SwiftStreamingMarkdownSample/Resources/Fixtures/kitchen-sink.md b/Examples/SwiftStreamingMarkdownSample/SwiftStreamingMarkdownSample/Resources/Fixtures/kitchen-sink.md index cac5589..62c6f9d 100644 --- a/Examples/SwiftStreamingMarkdownSample/SwiftStreamingMarkdownSample/Resources/Fixtures/kitchen-sink.md +++ b/Examples/SwiftStreamingMarkdownSample/SwiftStreamingMarkdownSample/Resources/Fixtures/kitchen-sink.md @@ -142,7 +142,7 @@ Container directives from Markdown-it and GitHub-style alerts are extension synt ::: > [!NOTE] -> GitHub alert syntax is included as another block quote extension. Unsupported renderers should display it as quoted text. +> GitHub alert syntax is included as another block quote extension. This should display with a colored bar and icon to the left. > [!WARNING] > Alerts with multiple paragraphs should still wrap and stream without corrupting following content. @@ -219,9 +219,9 @@ HTML blocks may render as plain text or be ignored depending on parser support. -## Mermaid diagram fallback +## Mermaid diagram -Mermaid is intentionally included as an unimplemented markdown feature. Until a diagram renderer exists, this should remain readable as a fenced code block. +Mermaid fences render as interactive diagrams. Configure them via `MermaidConfig`; setting `.disabled` falls back to a readable fenced code block. ```mermaid flowchart TD diff --git a/Package.resolved b/Package.resolved index e02a15b..a6fcc3b 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,23 @@ { "pins" : [ + { + "identity" : "beautiful-mermaid-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/lukilabs/beautiful-mermaid-swift", + "state" : { + "revision" : "6a23a29e91af8f5b3e9fc09945332ca193bd69ec", + "version" : "1.0.4" + } + }, + { + "identity" : "elk-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/lukilabs/elk-swift", + "state" : { + "revision" : "32f8042e3509a4819f00ff9cd46e829ec2b26da0", + "version" : "1.0.2" + } + }, { "identity" : "equatable", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index 1f3ddab..14aab1e 100644 --- a/Package.swift +++ b/Package.swift @@ -13,6 +13,7 @@ let package = Package( targets: ["SwiftStreamingMarkdown"]) ], dependencies: [ + .package(url: "https://github.com/lukilabs/beautiful-mermaid-swift", exact: "1.0.4"), .package(url: "https://github.com/ordo-one/equatable", exact: "1.4.1"), .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.19.4"), .package(url: "https://github.com/swiftlang/swift-markdown.git", exact: "0.7.3"), @@ -28,7 +29,8 @@ let package = Package( .product(name: "Markdown", package: "swift-markdown"), .product(name: "HighlightSwift", package: "highlightswift"), .product(name: "iosMath", package: "iosMath"), - .product(name: "Shimmer", package: "SwiftUI-Shimmer") + .product(name: "Shimmer", package: "SwiftUI-Shimmer"), + .product(name: "BeautifulMermaid", package: "beautiful-mermaid-swift") ], path: "Sources/MarkdownText", resources: [ diff --git a/README.md b/README.md index efae63a..a78a2ed 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ The renderer targets the subset of CommonMark + GitHub-flavored Markdown that LL - [x] `Inline code` - [x] Inline links - [x] Fenced code blocks with language tag +- [x] Mermaid diagrams — rendered as interactive diagrams for `mermaid`-tagged fenced code blocks; theme and opt-out via `MermaidConfig` (`withMermaidConfig`, `.disabled`) - [x] Block quotes (with nested inlines, lists, and citations) - [x] Ordered lists - [x] Unordered lists (with nesting) @@ -113,15 +114,15 @@ The renderer targets the subset of CommonMark + GitHub-flavored Markdown that LL - [x] Inline LaTeX math via `\( … \)` - [x] Display LaTeX math via `$$ … $$` - [x] Inline citation pills +- [x] GitHub alerts (`> [!NOTE]`) — rendered as block quotes with icon and color ### Not yet supported - [ ] Footnotes (`[^1]`) - [ ] Highlight (`==text==`), superscript (`^x^`), subscript (`~x~`) - [ ] Raw HTML (`
`, ``, `