Double parenthesis in links breaks Live Preview but works in Reading mode

Steps to reproduce

  1. Have a link with double parenthesis in it. I use Kibana (a data viz dashboard) where all links contain double parenthesis

  2. Put it in the note like so

[Kibana](https://redacted.eu-central-1.aws.cloud.es.io/app/kibana#/discover?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-24h,to:now))&_a=(columns:!(user.id,url.path),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:redacted,key:transaction.name,negate:!f,params:(query:'GET%20%2Fposts%2F:postId%2Ffiles%2F:fileId'),type:phrase),query:(match_phrase:(transaction.name:'GET%20%2Fposts%2F:postId%2Ffiles%2F:fileId')))),index:redacted,interval:auto,query:(language:kuery,query:''),sort:!()))
  1. Observe Live Preview by moving to different line
  2. Observe Reading mode by turning on with Cmd+e

Expected result

Only the link text to be visible in both Reading mode and Live-Preview

Actual result

  • Live Preview showing parts of the URL outside the link
  • Reading mode showing the link perfectly

Editing:

Live Preview:

Reading mode:

Environment

  • Operating system: MacOS 12.3.1
  • Debug info:
SYSTEM INFO:
	Obsidian version: v0.14.2
	Installer version: v0.11.5
	Operating system: Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 21.4.0
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: light
	Community theme: none
	Snippets enabled: 0
	Safe mode: on

RECOMMENDATIONS:
	none

Things that I have tried

  • URL encoded the whole URL

This caused obsidian to think it is a local link and tried opening a local file with this name

  • URL encoded just the hash part

This caused Kibana to not recognise the URL at all because it is not what it expects. Even encodeURIComponent function of javascript does not remove parenthesis because they are valid in URLs

Also noted that a single-level parenthesis works great and Obsidian has no problem with it.

Not got Obsidian with me to test this, but do html codes work?

(
opening parenthesis

)
closing parenthesis

Angel

FWIW, html codes work in live preview and reading mode:

[Kibana](https://redacted.eu-central-1.aws.cloud.es.io/app/kibana#/discover?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-24h,to:now))&_a=(columns:!(user.id,url.path),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:redacted,key:transaction.name,negate:!f,params:(query:'GET%20%2Fposts%2F:postId%2Ffiles%2F:fileId'),type:phrase),query:(match_phrase:(transaction.name:'GET%20%2Fposts%2F:postId%2Ffiles%2F:fileId')))),index:redacted,interval:auto,query:(language:kuery,query:''),sort:!()))

Angel

EDIT: Noticed that your installer is out of date for the version of Obsidian you are using. Won’t make any difference to this issue, but probably worth updating the installer anyway by grabbing a fresh download.

This is not a bug. You do need to URL encode parenthesis.

Thanks for all your input. I will add percent encoding to the URL.

In case any other Kibana users stumble upon this, I have written this text-expander code to replace characters while placing in Obsidian

function urlEncodeObsidian(urlString) {
  const url = new URL(urlString);
  url.hash =
    "#" +
    url.hash.slice(1).replace(/[!'()*]/g, function (c) {
      return "%" + c.charCodeAt(0).toString(16);
    });
  return url.href;
}

urlEncodeObsidian("%clipboard");

Escape logic is from this stack overflow answer

This one only works with url hash, but I think it can be improved to add support for special characters in path also.

I also tried with ( style encoding which works for showing on Obsidian, but the URL is different enough that Kibana does not recognise it.

1 Like

What is the difference between HTML entities and percent-encoding, and can both / either be used in Obsidian, or should we only use percent-encoding?

Thanks.

Angel

I reopen this bug report here specifically for round parenthesis.