Skip to content

[Repo Assist] Split MarkdownParser.fs into inline and block-level parsers#1052

Open
github-actions[bot] wants to merge 4 commits intomainfrom
repo-assist/fix-issue-1022-split-markdownparser-16a5f3382d0056f7
Open

[Repo Assist] Split MarkdownParser.fs into inline and block-level parsers#1052
github-actions[bot] wants to merge 4 commits intomainfrom
repo-assist/fix-issue-1022-split-markdownparser-16a5f3382d0056f7

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Closes #1022 (partial — continuing file-splitting work)

Summary

Split the 1500-line MarkdownParser.fs into two focused, cohesive files:

File Lines Contents
MarkdownInlineParser.fs ~560 InlineParser module — inline formatting: active patterns for emphasis/links/entities, ParsingContext type, parseChars, parseSpans
MarkdownParser.fs ~960 Parser module — block-level parsing: headings, lists, tables, blockquotes, code blocks, parseParagraphs

Root Cause / Rationale

MarkdownParser.fs mixed two distinct parsing concerns: inline span parsing (characters, emphasis, links) and block-level paragraph parsing. The natural break is at the section comment "Parsing of Markdown - second part handles paragraph-level formatting".

Changes

  • New: src/FSharp.Formatting.Markdown/MarkdownInlineParser.fsmodule internal FSharp.Formatting.Markdown.InlineParser
  • Modified: src/FSharp.Formatting.Markdown/MarkdownParser.fs — now module internal FSharp.Formatting.Markdown.Parser, opens InlineParser
  • Modified: src/FSharp.Formatting.Markdown/Markdown.fs — also opens InlineParser to access ParsingContext
  • Modified: FSharp.Formatting.Markdown.fsprojMarkdownInlineParser.fs added before MarkdownParser.fs
  • Modified: RELEASE_NOTES.md

Note

This avoids all files currently modified in open PRs (#1019: BuildCommand.fs, Literate.fs, Program.fs; #1045: SymbolReader.fs, ApiDocTypes.fs, GenerateHtml.fs etc.), per maintainer guidance.

Test Status

✅ All 257 markdown tests pass (dotnet test FSharp.Markdown.Tests).
✅ Fantomas formatting: no changes needed.
✅ Build: dotnet build succeeded with 0 warnings, 0 errors.

Generated by Repo Assist for issue #1022

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@afb00b92a9514fee9a14c583f059a03d05738f70

…er.fs

Split the 1500-line MarkdownParser.fs into two focused files:
- MarkdownInlineParser.fs: inline formatting (spans, chars, emphasis, links,
  ParsingContext type, parseChars, parseSpans)
- MarkdownParser.fs: block-level parsing (headings, lists, tables, blockquotes,
  parseParagraphs)

All 257 markdown tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review February 27, 2026 17:23
@dsyme
Copy link
Contributor

dsyme commented Feb 27, 2026

/repo-assist you should actually be deleting MarkdownParser.fs shouldn't you?

…BlockParser

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: 25292ea

Generated by Repo Assist

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

Good catch, @dsyme! You're right — the split should result in two new files replacing the original, not a modification of the old one.

I've pushed a follow-up commit that:

  • Renames MarkdownParser.fsMarkdownBlockParser.fs (git mv, preserving history)
  • Updates the module name: FSharp.Formatting.Markdown.ParserFSharp.Formatting.Markdown.BlockParser
  • Updates the open statement in Markdown.fs accordingly
  • Updates the .fsproj to reference MarkdownBlockParser.fs

The build still succeeds with 0 warnings/errors.

Generated by Repo Assist for issue #1052

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@afb00b92a9514fee9a14c583f059a03d05738f70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split large files across the repository

1 participant