You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Repo Assist] fix: use ctx.Newline in ToMd table rows and ToFsx output comments (#1195)
* fix: use ctx.Newline in ToMd table rows and ToFsx output comments
Previously, the TableBlock serialiser in MarkdownUtils.fs joined all data
rows into a single string using String.concat "\\n" (hardcoded Unix newline),
and then emitted a literal "\n" string as the trailing blank line sentinel.
On Windows (ctx.Newline = "\r\n") this produced mixed line endings in the
ToMd output.
This commit refactors the TableBlock case to yield each data row as a
separate string (consistent with every other paragraph type), so the outer
String.concat newline in formatAsMarkdown applies the correct separator.
The trailing blank line now uses the standard "" empty-line sentinel.
FsxFormatting.fs had the same kind of issue: the (\* output: ...*) comment
wrapper used a literal "\n" to open the comment block. It now uses
ctx.Newline so both the opening and the content use consistent line endings.
Two new unit tests cover the table row count and the Windows regression.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: trigger checks
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: RELEASE_NOTES.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@
11
11
* Replace `Enumerable.Cast<XAttribute>` (LINQ) with `Seq.cast<XAttribute>` (idiomatic F#) in `MarkdownUtils.fs`, removing the `open System.Linq` import.
12
12
13
13
### Fixed
14
+
* Fix `Markdown.ToMd` serialising table data rows with a hardcoded `\n` line separator instead of the configured newline. On Windows (where `Environment.NewLine` is `\r\n`) this produced mixed line endings in the output. Each data row is now yielded separately, consistent with how every other paragraph type works. The trailing blank line after a table was also emitting a literal `"\n"` string instead of the standard `""` empty-line sentinel.
15
+
* Fix `Markdown.ToFsx` hardcoding a `\n` newline in the `(* output: ...)` comment wrapper around code-cell outputs. The configured `ctx.Newline` is now used, ensuring consistent line endings on Windows.
14
16
* Fix `Markdown.ToMd` silently dropping YAML frontmatter when serialising a parsed `MarkdownDocument` back to Markdown text. Frontmatter is now preserved with its `---` delimiters.
15
17
* Fix `Markdown.ToMd` converting tight lists (no blank lines between items) into loose lists by emitting a blank line after every item. Tight lists now round-trip correctly without inter-item blank lines.
16
18
* Fix `Markdown.ToMd` serialising `HardLineBreak` as a bare newline instead of two trailing spaces + newline. The correct CommonMark representation `" \n"` is now emitted, so hard line breaks survive a round-trip through `ToMd`.
0 commit comments