From 0b91a3fb1562e2d2a397a7599ae513b54765b545 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Sat, 9 May 2026 00:46:00 +0000
Subject: [PATCH 1/2] fix: Markdown.ToMd serialises AnchorLink as inline HTML
anchor
Previously AnchorLink spans were silently dropped (rendered as "").
Named anchors are now emitted as inline HTML
so they survive a ToMd round-trip and remain functional when the
output is later converted to HTML.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
RELEASE_NOTES.md | 1 +
src/FSharp.Formatting.Markdown/MarkdownUtils.fs | 2 +-
tests/FSharp.Markdown.Tests/Markdown.fs | 17 +++++++++++++++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index c328fb393..ae29b4608 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -20,6 +20,7 @@
* Remove stray `printfn` debug output emitted to stdout when `Markdown.ToMd` encountered an unrecognised paragraph type.
* Fix `Markdown.ToLatex` producing invalid LaTeX output for level-6 (and deeper) headings. Previously the LaTeX command was an empty string, resulting in bare `{content}` without a command prefix. Headings at level 6+ are now serialised as `\subparagraph{...}`, which is the deepest sectioning command available in LaTeX.
* Fix `Markdown.ToMd` serialising unresolved indirect links as `[body](key)` (treating the reference key as a URL) instead of the correct `[body][key]` form. Unresolved indirect links are now preserved in their original indirect-reference form, consistent with how unresolved indirect images are handled.
+* Fix `Markdown.ToMd` silently dropping `AnchorLink` spans. Named anchors (used by the API documentation generator to create in-page navigation targets) are now serialised as `` inline HTML, so they survive a round-trip and remain functional when the output is later converted to HTML.
### Added
* Introduce `--panel-background` and `--panel-border` CSS custom properties in `fsdocs-default.css`. These decouple panel/component colours (copy-code button, blockquotes, sidebar, page menu, dialogs, tooltips, API tables) from `--header-background`/`--header-border`. Both variables default to the header values, so existing themes are unaffected; themes that need a different colour for content panels can now override `--panel-background` and `--panel-border` independently. [#1156](https://github.com/fsprojects/FSharp.Formatting/issues/1156)
diff --git a/src/FSharp.Formatting.Markdown/MarkdownUtils.fs b/src/FSharp.Formatting.Markdown/MarkdownUtils.fs
index 06b8d6584..4a9554a07 100644
--- a/src/FSharp.Formatting.Markdown/MarkdownUtils.fs
+++ b/src/FSharp.Formatting.Markdown/MarkdownUtils.fs
@@ -104,7 +104,7 @@ module internal MarkdownUtils =
| Literal(str, _) -> str
| HardLineBreak(_) -> " " + ctx.Newline
- | AnchorLink _ -> ""
+ | AnchorLink(link, _) -> sprintf "" link
| DirectLink(body, link, title, _) ->
let t =
title
diff --git a/tests/FSharp.Markdown.Tests/Markdown.fs b/tests/FSharp.Markdown.Tests/Markdown.fs
index 9ca635226..2aefacfe7 100644
--- a/tests/FSharp.Markdown.Tests/Markdown.fs
+++ b/tests/FSharp.Markdown.Tests/Markdown.fs
@@ -2056,3 +2056,20 @@ let ``ToMd serialises single-line equation block as compact dollar-dollar notati
let result = Markdown.ToMd(doc, newline = "\n")
result |> should contain "$$E = mc^2$$"
result |> should not' (contain "\\begin{equation}")
+
+[]
+let ``ToMd serialises AnchorLink as inline HTML anchor`` () =
+ // AnchorLink spans must not be silently dropped — they should be emitted as
+ // so that named anchors survive a ToMd round-trip and remain functional when later converted to HTML.
+ let doc =
+ MarkdownDocument(
+ [ Paragraph(
+ [ AnchorLink("my-anchor", MarkdownRange.zero); Literal("text", MarkdownRange.zero) ],
+ MarkdownRange.zero
+ ) ],
+ dict []
+ )
+
+ let result = Markdown.ToMd(doc, newline = "\n")
+ result |> should contain ""
+ result |> should contain "text"
From 3f4a5c53e5c9f97e72e7d19901e5d1a41f819ae4 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
Date: Sat, 9 May 2026 00:46:03 +0000
Subject: [PATCH 2/2] ci: trigger checks