Skip to content

Enhancement (config): Add option $imageAltText to remove image alternative text - #201

Open
El1as42 wants to merge 1 commit into
theohbrothers:masterfrom
El1as42:enhancement/config-add-option-imagealttext-to-remove-image-alternative-text
Open

El1as42 wants to merge 1 commit into
theohbrothers:masterfrom
El1as42:enhancement/config-add-option-imagealttext-to-remove-image-alternative-text

Conversation

@El1as42

@El1as42 El1as42 commented Oct 13, 2026

Copy link
Copy Markdown

Closes #198

Images in OneNote usually have an alternative text, which is text that OneNote recognized in the image. It can be very long and contain characters like |, [ and ], so some markdown viewers like Obsidian fail to render the image and show the alternative text instead.

Changes

  • New config option $imageAltText: 1 keeps the alternative text (default, existing behavior), 2 removes it. E.g. ![some text](../media/image1.png) becomes ![](../media/image1.png).
  • The removal runs before the $keepescape mutation, while pandoc's escapes of [ and ] are still intact, so the end of the alternative text is found reliably.

Tests: a New-SectionGroupConversionConfig test for both values, including alternative text with escaped brackets and backslashes. 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).

🤖 Generated with Claude Code

…rnative text

For images in OneNote, the image alternative text is usually text recognized in the image by OneNote, which can be very long and contain characters like `|`, `[`, and `]`. Some markdown viewers like Obsidian then fail to render the image, and show the alternative text instead.

`$imageAltText = 2` removes the alternative text, e.g. `![some text](../media/image1.png)` becomes `![](../media/image1.png)`. The default `$imageAltText = 1` keeps the existing behavior.

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 remove the alternative text of images

1 participant