Conversation
Markdown.ToMd (formatAsMarkdown) called formatSpan in MarkdownUtils.fs which had a failwith "tbd - IndirectImage" for both arms of IndirectImage. This caused any call to Markdown.ToMd on a document containing Fix: implement the two cases by analogy with IndirectLink: (preserving the original indirect form) Add two regression tests in FSharp.Markdown.Tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6 tasks
dsyme
approved these changes
Mar 17, 2026
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 PR from Repo Assist.
Problem
Markdown.ToMd(and any pipeline that serialises a parsed Markdown AST back to Markdown text, such asOutputKind.Markdownliterate output) would throwSystem.Exception: tbd - IndirectImagewhen the document contained a reference-style image:The crash came from
MarkdownUtils.fs— theformatSpanfunction had afailwith "tbd - IndirectImage"placeholder for both arms of theIndirectImagecase:Fix
Implement
IndirectImageserialisation by analogy withIndirectLink(which already handles both the resolved and unresolved cases):failwith "tbd"(promote to direct image)failwith "tbd"![alt][key](preserve original indirect form)Root cause
The
IndirectImagecase was left as atbdstub when the Markdown-to-Markdown formatting was originally written. All other span types were already handled.Test status
dotnet build FSharp.Formatting.sln --configuration Release— succeeded (0 errors, 1 pre-existing FS0760 warning)dotnet test tests/FSharp.Markdown.Tests/— 259 passed, 0 failed (+2 new tests covering both cases)dotnet fantomas src/FSharp.Formatting.Markdown/MarkdownUtils.fs tests/FSharp.Markdown.Tests/Markdown.fs --check— no formatting changes neededFiles changed
src/FSharp.Formatting.Markdown/MarkdownUtils.fsIndirectImageinformatSpan— two lines replacing thefailwithtests/FSharp.Markdown.Tests/Markdown.fsRELEASE_NOTES.md[Unreleased]