Skip to content

Fix: Escape parentheses in markdown link URLs from DOCX conversion#33

Open
oxygen-dioxide wants to merge 1 commit into
manfromarce:mainfrom
oxygen-dioxide:url-parentheses
Open

Fix: Escape parentheses in markdown link URLs from DOCX conversion#33
oxygen-dioxide wants to merge 1 commit into
manfromarce:mainfrom
oxygen-dioxide:url-parentheses

Conversation

@oxygen-dioxide

Copy link
Copy Markdown

Description

When converting DOCX files to Markdown, hyperlinks containing parentheses in their URLs produce broken markdown. For example, a link to https://en.wikipedia.org/wiki/Mole_(unit) would generate:

[text](https://en.wikipedia.org/wiki/Mole_(unit))

The unescaped ) prematurely terminates the markdown link syntax [text](url), resulting in malformed output.

Fix

Added percent-encoding for parentheses in the target URL within MarkdownStringWriter.WriteHyperlink (src/DocSharp.Common/Writers/MarkdownStringWriter.cs:117):

  • (%28
  • )%29

#32 is fixed.

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.

1 participant