Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Changed
* Rewrote the Mermaid documentation recipe as `docs/mermaid.md` (moved from the oddly-named `docs/sidebyside/sidemermaid.md`) to follow the approach used by the fantomas docs: diagrams are written as plain ```mermaid fenced code blocks, which GitHub renders natively, and an `_body.html` script promotes those blocks into `<div class="mermaid">` elements on fsdocs pages. The FSharp.Formatting docs now ship that script (`docs/_body.html`), so the recipe page actually demonstrates working diagrams.

### Fixed
* Fix `FrontMatterFile.ParseFromLines` truncating front-matter values that contain a `:` character (e.g. `title: F#: An Introduction` was previously captured as just `F#`). Additional colons in a value are now preserved.

## [22.2.0] - 2026-08-31

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Formatting.Common/Templating.fs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type FrontMatterFile =
let parts = line.Split(":") |> Array.toList

match parts with
| first :: second :: _ -> Some(first.ToLowerInvariant(), second)
| first :: rest when not rest.IsEmpty -> Some(first.ToLowerInvariant(), String.Join(":", rest))
| _ -> None
else
None)
Expand Down
21 changes: 21 additions & 0 deletions tests/FSharp.Literate.Tests/DocContentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -745,3 +745,24 @@ let ``LlmsTxt collapses excessive blank lines in content`` () =
llmsFullTxt.Contains("\n\n\n") |> shouldEqual false
llmsFullTxt |> shouldContainText "First paragraph"
llmsFullTxt |> shouldContainText "Second paragraph"

// --------------------------------------------------------------------------------------
// Tests for FrontMatterFile.ParseFromLines
// --------------------------------------------------------------------------------------

[<Test>]
let ``ParseFromLines preserves colons in front-matter values`` () =
let lines = [ "---"; "title: F#: An Introduction"; "category: Guides"; "categoryindex: 2"; "index: 1"; "---" ]

match FrontMatterFile.ParseFromLines "test.md" lines with
| Some frontMatter ->
frontMatter.Category |> shouldEqual "Guides"
frontMatter.CategoryIndex |> shouldEqual 2
frontMatter.Index |> shouldEqual 1
| None -> failwith "Expected front matter to be parsed"

[<Test>]
let ``ParseFromLines returns None when required fields are missing`` () =
let lines = [ "---"; "title: No Category Here"; "---" ]

FrontMatterFile.ParseFromLines "test.md" lines |> shouldEqual None