Skip to content
Merged
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
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<a name="..."></a>` 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)
Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Formatting.Markdown/MarkdownUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module internal MarkdownUtils =
| Literal(str, _) -> str
| HardLineBreak(_) -> " " + ctx.Newline

| AnchorLink _ -> ""
| AnchorLink(link, _) -> sprintf "<a name=\"%s\"></a>" link
| DirectLink(body, link, title, _) ->
let t =
title
Expand Down
17 changes: 17 additions & 0 deletions tests/FSharp.Markdown.Tests/Markdown.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

[<Test>]
let ``ToMd serialises AnchorLink as inline HTML anchor`` () =
// AnchorLink spans must not be silently dropped β€” they should be emitted as <a name="…"></a>
// 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 "<a name=\"my-anchor\"></a>"
result |> should contain "text"
Loading