Skip to content

Commit 8978eef

Browse files
authored
Merge branch 'main' into repo-assist/fix-tomd-yaml-frontmatter-2026-04-13-bca272bf909c4735
2 parents 7b504b1 + 8d7f4ef commit 8978eef

6 files changed

Lines changed: 19 additions & 6 deletions

File tree

.github/workflows/pull-requests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
run: dotnet fsi build.fsx
4646

4747
- name: Upload test results
48-
uses: actions/upload-artifact@v4
48+
uses: actions/upload-artifact@v7
4949
if: failure()
5050
with:
5151
name: test-results-${{ matrix.os }}

.github/workflows/push-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
run: dotnet fsi build.fsx
4444

4545
- name: Upload test results
46-
uses: actions/upload-artifact@v4
46+
uses: actions/upload-artifact@v7
4747
if: failure()
4848
with:
4949
name: test-results-ubuntu

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
2222
<PackageVersion Include="NUnit" Version="4.5.1" />
2323
<PackageVersion Include="FsUnit" Version="7.1.1" />
24-
<PackageVersion Include="FSharp.Data" Version="8.1.6" />
24+
<PackageVersion Include="FSharp.Data" Version="8.1.7" />
2525
<PackageVersion Include="NUnit3TestAdapter" Version="6.2.0" />
2626
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
2727
<PackageVersion Include="Ionide.KeepAChangelog.Tasks" Version="0.3.3" />

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Fixed
66
* Fix `Markdown.ToMd` silently dropping YAML frontmatter when serialising a parsed `MarkdownDocument` back to Markdown text. Frontmatter is now preserved with its `---` delimiters.
7+
* Fix `Markdown.ToMd` silently dropping `EmbedParagraphs` nodes: the serialiser now delegates to the node's `Render()` method and formats the resulting paragraphs, consistent with the HTML and LaTeX back-ends.
78
* Fix `Markdown.ToMd` dropping link titles in `DirectLink` and `DirectImage` spans. Links with a title attribute (e.g. `[text](url "title")`) now round-trip correctly; without this fix the title was silently discarded on serialisation.
89
* Fix `Markdown.ToMd` serialising inline code spans that contain backtick characters. Previously, `InlineCode` was always wrapped in single backticks, producing syntactically incorrect Markdown when the code body contained backticks. Now the serialiser selects the shortest backtick fence that does not collide with the body content (e.g. a double-backtick fence for bodies containing single backticks, triple for double, etc.), matching the CommonMark spec.
910

src/FSharp.Formatting.Markdown/MarkdownUtils.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,7 @@ module internal MarkdownUtils =
287287
yield "> " + line
288288

289289
yield ""
290-
| _ ->
291-
printfn "// can't yet format %0A to markdown" paragraph
292-
yield "" ]
290+
| EmbedParagraphs(cmd, _) -> yield! cmd.Render() |> Seq.collect (formatParagraph ctx) ]
293291

294292
/// Strips <c>#if SYMBOL</c> / <c>#endif // SYMBOL</c> conditional compilation lines from an .fsx code block
295293
/// so that format-specific sections are removed from non-target output formats.

tests/FSharp.Markdown.Tests/Markdown.fs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,3 +1433,17 @@ let ``ToMd preserves empty YAML frontmatter`` () =
14331433
let result = input |> toMd
14341434
result |> should contain "---"
14351435
result |> should contain "Hello."
1436+
1437+
[<Test>]
1438+
let ``ToMd serialises EmbedParagraphs by delegating to Render()`` () =
1439+
// EmbedParagraphs was previously falling through to the catch-all '| _' branch,
1440+
// emitting a debug printfn and yielding an empty string. It should instead
1441+
// delegate to the Render() method and format the resulting paragraphs.
1442+
let inner =
1443+
{ new MarkdownEmbedParagraphs with
1444+
member _.Render() =
1445+
[ Paragraph([ Literal("embedded text", MarkdownRange.zero) ], MarkdownRange.zero) ] }
1446+
1447+
let doc = MarkdownDocument([ EmbedParagraphs(inner, MarkdownRange.zero) ], dict [])
1448+
let result = Markdown.ToMd(doc)
1449+
result |> should contain "embedded text"

0 commit comments

Comments
 (0)