Conversation
When Markdown.ToMd serialises a parsed MarkdownDocument back to Markdown text, YamlFrontmatter paragraphs were silently dropped. Documents containing a YAML front-matter block (--- ... ---) would lose that block on round-trip. Fix: emit the --- delimiters and frontmatter lines in formatParagraph so round-trips are lossless. Add two new tests: one with populated frontmatter and one with an empty block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…4-13-bca272bf909c4735
…4-13-bca272bf909c4735
…4-13-bca272bf909c4735
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist.
Summary
Markdown.ToMdwas silently dropping YAML front-matter blocks when serialising a parsedMarkdownDocumentback to Markdown text. Any document opened with a---...---front-matter block would lose it on round-trip.Root Cause
In
MarkdownUtils.fs, theformatParagraphfunction had:This matched the
YamlFrontmatterAST node and emitted nothing. For HTML and LaTeX output formats this is correct (front-matter is metadata, not content), but for the Markdown serialiser (ToMd) it means the front-matter is permanently lost.Fix
Emit the
---delimiters and the front-matter lines informatParagraph:Tests
Two new
[<Test>]cases added toFSharp.Markdown.Tests:ToMd preserves YAML frontmatter— round-trips a document with populated front-matterToMd preserves empty YAML frontmatter— round-trips a document with empty---\n---blockTest Status
FSharp.Markdown.Tests: 283 passed, 0 failed (2 new tests added)FSharp.Literate.Tests: 143 passed, 0 failedFSharp.ApiDocs.Tests: 80 pre-existing failures onmain(unrelated to this change, verified by running on unmodifiedmain)