Skip to content

Enhancement (config): Add option $paragraphSeparator to separate paragraphs with a newline instead of a blank line - #211

Open
El1as42 wants to merge 1 commit into
theohbrothers:masterfrom
El1as42:enhancement/config-add-option-paragraphseparator-to-separate-paragraphs-with-a-newline-instead-of-a-blank-line
Open

El1as42 wants to merge 1 commit into
theohbrothers:masterfrom
El1as42:enhancement/config-add-option-paragraphseparator-to-separate-paragraphs-with-a-newline-instead-of-a-blank-line

Conversation

@El1as42

@El1as42 El1as42 commented Oct 13, 2026

Copy link
Copy Markdown

Closes #208

In OneNote, the paragraphs of a page are on consecutive lines, but pandoc separates each paragraph with a blank line. So the lines of a page are spread apart in the markdown.

Changes

  • New config option $paragraphSeparator: 1 separates paragraphs with a blank line (default, existing behavior), 2 with a newline, like in OneNote. E.g. foo\n\nbar becomes foo\nbar.
    • Paragraphs separated by an empty paragraph are still separated by a blank line.
    • Lists, tables, headings, code, and quotes keep their blank lines, since they would otherwise change meaning (e.g. a line after a list item would become part of it). Paragraphs within a quote are separated by a newline.
    • Lines that would turn the previous line into a heading (e.g. ===) also keep their blank line.
  • README.md and config.example.ps1 document the option.

Markdown viewers like Obsidian show a newline as a line break (unless its "Strict line breaks" setting is on), while others like GitHub join such lines into one paragraph. This is why it is an option, and noted in its description.

Note: with $keepspaces = 1, an empty paragraph currently becomes three blank lines. #209 changes this to a single blank line, which this option builds on, but the two PRs do not depend on each other.

Tests: a New-SectionGroupConversionConfig test for both values, with paragraphs, an empty paragraph, an image, a heading, a list, a table, a quote, and ===. Unit tests pass on Windows PowerShell 5.1 and PowerShell 7.0. In this repo's CI (run on my fork), all jobs that can currently run pass: Windows PowerShell 5.1 (windows-2022) and PowerShell 7.1 to 7.4. The other jobs currently fail for any PR, before checkout: the windows-2019 runner image was retired, and the PowerShell 6.0 to 7.0 container images are too old for actions/checkout (GLIBC_2.28' not found). Also tested on real notebook pages: lines that follow each other in OneNote follow each other in the markdown, and empty paragraphs become blank lines.

🤖 Generated with Claude Code

…ragraphs with a newline instead of a blank line

In OneNote, the paragraphs of an outline are on consecutive lines, but pandoc separates each paragraph with a blank line. So a page's lines are spread apart in the markdown, and paragraphs that follow each other cannot be told apart from paragraphs separated by an empty paragraph.

The new option `$paragraphSeparator = 2` separates paragraphs with a newline instead, which markdown viewers like Obsidian show as a line break. Paragraphs separated by an empty paragraph, as well as lists, tables, headings, and quotes, are still separated by a blank line. Lines that would turn the previous line into a heading (e.g. `===`) are also still separated by a blank line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to separate paragraphs with a newline instead of a blank line

1 participant