Skip to content

Commit 0fe067d

Browse files
authored
Merge pull request #139 from jongalloway/chore/upgrade-diagramforge-1.1.0
chore: upgrade DiagramForge to 1.1.0
2 parents a97d506 + 533d3db commit 0fe067d

5 files changed

Lines changed: 103 additions & 3 deletions

File tree

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageVersion Include="DiagramForge" Version="1.0.0" />
6+
<PackageVersion Include="DiagramForge" Version="1.1.0" />
77
<PackageVersion Include="DocumentFormat.OpenXml" Version="3.4.1" />
88
<PackageVersion Include="Markdig" Version="1.1.1" />
99
<PackageVersion Include="MinVer" Version="7.0.0" />

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ There's just one hangup. When you're asked to turn in a PowerPoint deck at a con
1818

1919
**That's where MarpToPptx comes in. 🎉** It reads your Marp-flavored Markdown and produces native Open XML PowerPoint files where every heading, bullet, table, and code block is a real, selectable, editable PowerPoint shape. The output opens cleanly in PowerPoint — no repair prompts, no surprises.
2020

21-
> Diagram support: MarpToPptx renders both `mermaid` fences and `diagram` fences through [DiagramForge](https://github.com/jongalloway/DiagramForge), so Mermaid subsets plus conceptual layouts like matrix and pyramid can be embedded directly in your deck source.
21+
> Diagram support: MarpToPptx renders both `mermaid` fences and `diagram` fences through [DiagramForge](https://github.com/jongalloway/DiagramForge), so Mermaid subsets plus conceptual layouts like matrix, pyramid, funnel, and radial can be embedded directly in your deck source.
2222
2323
```mermaid
2424
flowchart LR

samples/09-diagrams.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,33 @@ pillars:
221221
- OpenAI
222222
- Search
223223
```
224+
225+
---
226+
227+
## Conceptual Funnel
228+
229+
Uses the deck-level `diagram-theme: prism`.
230+
231+
```diagram
232+
diagram: funnel
233+
stages:
234+
- Awareness
235+
- Evaluation
236+
- Conversion
237+
```
238+
239+
---
240+
241+
## Conceptual Radial
242+
243+
Uses the deck-level `diagram-theme: prism`.
244+
245+
```diagram
246+
diagram: radial
247+
center: Platform
248+
items:
249+
- Security
250+
- Reliability
251+
- Observability
252+
- Developer Experience
253+
```

samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Dedicated smoke deck for presenter notes packaging, including note-bearing slide
3131
Speaker-style showcase deck generated from repo content, using `08-showcase.css` plus local Marp SVG assets to cover the Marp ecosystem, MarpToPptx capabilities, presenter notes, and the recommended VS Code task configuration.
3232

3333
9. `09-diagrams.md`
34-
Diagram-focused sample deck that mixes Mermaid fences and `diagram` fences to exercise DiagramForge-backed flowchart, block, state, mindmap, matrix, and pyramid output with the companion `09-diagrams.css` theme.
34+
Diagram-focused sample deck that mixes Mermaid fences and `diagram` fences to exercise DiagramForge-backed flowchart, block, state, mindmap, matrix, pyramid, funnel, and radial output with the companion `09-diagrams.css` theme.
3535

3636
## Theme Decks
3737

tests/MarpToPptx.Tests/PptxRendererTests.cs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5383,6 +5383,76 @@ public void Renderer_DiagramFence_Matrix_WithEmbeddedFrontMatter_RendersSvg()
53835383
Assert.Empty(validationErrors);
53845384
}
53855385

5386+
[Fact]
5387+
public void Renderer_DiagramFence_FunnelAndRadial_WithEmbeddedFrontMatter_RenderSvg()
5388+
{
5389+
using var workspace = TestWorkspace.Create();
5390+
5391+
var markdownPath = workspace.WriteMarkdown(
5392+
"deck.md",
5393+
"""
5394+
# Funnel Diagram
5395+
5396+
```diagram
5397+
---
5398+
theme: presentation
5399+
---
5400+
diagram: funnel
5401+
stages:
5402+
- Awareness
5403+
- Evaluation
5404+
- Conversion
5405+
```
5406+
5407+
---
5408+
5409+
# Radial Diagram
5410+
5411+
```diagram
5412+
---
5413+
theme: presentation
5414+
---
5415+
diagram: radial
5416+
center: Platform
5417+
items:
5418+
- Security
5419+
- Reliability
5420+
- Observability
5421+
- Developer Experience
5422+
```
5423+
""");
5424+
5425+
var outputPath = workspace.GetPath("deck.pptx");
5426+
RenderDeck(markdownPath, outputPath, workspace.RootPath);
5427+
5428+
using var document = PresentationDocument.Open(outputPath, false);
5429+
var slideParts = document.PresentationPart!.SlideParts.ToArray();
5430+
Assert.Equal(2, slideParts.Length);
5431+
5432+
foreach (var slidePart in slideParts)
5433+
{
5434+
var pictures = slidePart.Slide!.Descendants<P.Picture>().ToArray();
5435+
Assert.NotEmpty(pictures);
5436+
5437+
var svgPart = slidePart.ImageParts
5438+
.FirstOrDefault(p => string.Equals(p.ContentType, "image/svg+xml", StringComparison.OrdinalIgnoreCase));
5439+
Assert.NotNull(svgPart);
5440+
5441+
using var stream = svgPart!.GetStream();
5442+
var svg = new StreamReader(stream).ReadToEnd();
5443+
Assert.Contains("<svg", svg, StringComparison.OrdinalIgnoreCase);
5444+
5445+
var svgRelId = slidePart.GetIdOfPart(svgPart);
5446+
Assert.Contains(pictures, pic => pic.Descendants<DocumentFormat.OpenXml.Office2019.Drawing.SVG.SVGBlip>().Any(b => b.Embed?.Value == svgRelId));
5447+
5448+
var textRuns = slidePart.Slide.Descendants<A.Text>().Select(t => t.Text).ToArray();
5449+
Assert.DoesNotContain(textRuns, t => t.StartsWith("Diagram parse error:", StringComparison.Ordinal));
5450+
}
5451+
5452+
var validationErrors = new OpenXmlPackageValidator().Validate(document);
5453+
Assert.Empty(validationErrors);
5454+
}
5455+
53865456
[Fact]
53875457
public void Renderer_DiagramFence_Pyramid_WithEmbeddedFrontMatter_RendersSvg()
53885458
{

0 commit comments

Comments
 (0)