Conversation
Previously Markdown.ToLatex had no direct unit test coverage — only
file-based comparisons in the obsolete TestFiles.fs and two indirect
tests through Literate.ToLatex.
Add 28 tests covering:
- Headings (all six levels: section*/subsection*/subsubsection*/paragraph/subparagraph)
- Inline formatting: bold (\textbf), italic (\emph), inline code (\texttt)
- Links (\href{url}{text})
- Images (\includegraphics) and images with alt text (figure + caption)
- Unordered list (\begin{itemize}) and ordered list (\begin{enumerate})
- Code blocks (\begin{lstlisting})
- Blockquotes (\begin{quote})
- Horizontal rule (\noindent\makebox...)
- Tables (\begin{tabular}) with bold headers
- LaTeX special character escaping (#, %, &, _)
- Inline math ($...$)
- Display math (5042...5042 parsed as LatexBlock → \begin{equation}...\end{equation})
- EmbedParagraphs delegation to Render()
- Empty document handling
All 345 markdown tests pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Level-6 headings (######) were mapped to an empty string in the LaTeX
sectioning command match, producing bare '{content}' without any command
prefix — invalid LaTeX. LaTeX has five sectioning levels:
\section*, \subsection*, \subsubsection*, \paragraph, \subparagraph.
Fix by treating any heading level > 5 as \subparagraph (the deepest
available LaTeX sectioning command), matching what most LaTeX documents
expect.
Also removes the now-dead case for level 5 (merged into the catch-all).
Test status: 346 markdown tests pass, 143 literate tests pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
10 tasks
dsyme
approved these changes
Apr 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 pull request from Repo Assist.
Summary
Two related improvements to
Markdown.ToLatex:Testing (Task 9): Add 29 direct unit tests for
Markdown.ToLatex— this output format previously had zero unit test coverage (only obsolete file-comparison tests inTestFiles.fsand two indirect Literate tests).Bug fix (Task 3): Fix a bug where level-6 headings (
######) produced invalid LaTeX output.Bug Fix: Level-6 Headings in ToLatex
Root cause:
LatexFormatting.fsmatched heading levels 1–5 to LaTeX commands, but had| _ -> ""as the catch-all. For a level-6 heading,level = "", producing{content}— braces without any command prefix, which is invalid LaTeX.Fix: Replace
| _ -> ""with| _ -> @"\subparagraph". Since\subparagraphis the deepest LaTeX sectioning command, all headings at level 5 and above correctly map to it.Example:
New Test Coverage
29 tests added to
tests/FSharp.Markdown.Tests/Markdown.fscovering:\section*{...}\subsection*{...}\subsubsection*{...}\paragraph{...}\subparagraph{...}\subparagraph{...}\textbf{...}\emph{...}\texttt{...}\href{url}{text}\begin{itemize}...\item...\end{itemize}\begin{enumerate}...\item...\end{enumerate}\begin{lstlisting}...\end{lstlisting}\begin{quote}...\end{quote}\noindent\makebox...\begin{tabular}with bold headers\begin{figure}...\caption{...}...\end{figure}\includegraphics{...}\#,\%,\&,\_$E = mc^2$\begin{equation}...\end{equation}EmbedParagraphsRender()Test Status