Extend URL-encoding in Obsidian URL generation

Use case or problem

Currently (as at Obsidian version 1.12.7), copying an Obsidian URL applies URL-encoding to many characters such as spaces ( ) and slashes (/) appearing in note paths. However, it doesn’t apply URL-encoding to open or close parentheses ((, )). Although perfectly legal for use in URLs unencoded, these characters can cause friction for downstream use of these URLs. A motivating example is pasting URLs into Markdown [text](url) links, where the closing parenthesis would parse as terminating the URL.

Proposed solution

Extend existing URL-encoding, to cover parentheses as well (encoding ( and %28 and ) as %29). Consider also encoding other additional characters not currently encoded: -._~'! - particularly ' and perhaps ! to be more ‘terminal-friendly’.

Current workaround (optional)

As a workaround, the user can take additional steps to URL-encode parentheses before pasting them elsewhere.

Related feature requests (optional)

  • This feature request covers copying a Markdown-style link, which would help in some cases. Worth a mention, backslash-escaping the parentheses rather than URL-encoding would be valid, but anecdotally more likely to trigger bugs in Markdown implementations that don’t handle this correctly (e.g. TickTick).
    “Copy Obsidian URL” links in note menu with name of the note
  • A related Help request