Skip to content

Fix: Fix blank lines being added at the end of the markdown file for each image on the page - #210

Open
El1as42 wants to merge 1 commit into
theohbrothers:masterfrom
El1as42:fix/fix-blank-lines-being-added-at-the-end-of-the-markdown-file-for-each-image-on-the-page
Open

El1as42 wants to merge 1 commit into
theohbrothers:masterfrom
El1as42:fix/fix-blank-lines-being-added-at-the-end-of-the-markdown-file-for-each-image-on-the-page

Conversation

@El1as42

@El1as42 El1as42 commented Oct 13, 2026

Copy link
Copy Markdown

Fixes #207

Each image reference is renamed by reading the markdown file and writing it back with Set-ContentNoBom, which appends a newline each time. So a page ended with one blank line for each image, e.g. 27 blank lines for a page with a slide and a pen drawing of 26 strokes.

Changes

  • Convert-OneNotePage: remove trailing blank lines before writing the final markdown file. The file still ends with a single newline, appended by Set-ContentNoBom as before. This also covers any other rewrite of the markdown file before that step.
  • Set-ContentNoBom is unchanged, since the final file should end with a newline.

Tests: a Convert-OneNotePage test that the final markdown has no trailing blank lines. It fails without the fix. 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: they ended with 26 and 28 blank lines before, and with a single newline now.

🤖 Generated with Claude Code

…each image on the page

Each image reference is renamed by reading the markdown file and writing it back with `Set-ContentNoBom`, which appends a newline. So a page with e.g. 27 images (pen/hand written drawings are exported as one image per stroke) ended with 27 blank lines.

Now trailing blank lines are removed before writing the final markdown file, which still ends with a single newline.

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.

Blank lines are added at the end of the markdown file for each image on the page

1 participant