Markdown links containing parentheses

I want to make my ELC links clickable, but I ran into a problem - they contain parentheses (lots of parentheses!). Escaping parentheses with \ doesn’t work, using %28 and %29 doesn’t work - the link just doesn’t open. Please, is there any way to make this work?

Hi @gunfigther,

Thank you for contacting Octopus Support.

Can you tell me where you are trying to make links clickable? (such as in the logs or subscription email template, etc) If you can provide a screenshot without revealing sensitive information, that would be helpful as well.

Let me know at your earliest convenience.

Best Regards,
Donny Bell

scr

I’m trying to do this on the “Task progress” screen using Write-Highlight function. As you can see, I get a link using %28 and %29, but it doesn’t open correctly. When I using escape characters, the link is not clickable at all.

Hi @gunfigther,

Thank you for getting back to me.

Would you mind sharing the snippet of script you are using to do this?

Let me know at your earliest convenience.

Best Regards,
Donny Bell

something like that:

$elk_link = "https://ELK-INSTANCE/app/discover#/?_a=%28columns:!%28%29,filters:!%28%28'$state':%28store:appState%29,meta:%28alias:!n,disabled:!f,index:affe2810-4ab4-11eb-b48b-ad9471fe1eb3,key:_index,negate:!f,params:%28query:#{IIS.PackageName}%29,type:phrase%29,query:%28match_phrase:%28_index:#{IIS.PackageName}%29%29%29%29,index:affe2810-4ab4-11eb-b48b-ad9471fe1eb3,interval:auto,query:%28language:kuery,query:''%29,sort:!%28!%28'@timestamp',desc%29%29%29&_g=%28filters:!%28%29,refreshInterval:%28pause:!t,value:0%29,time:%28from:now-1h,to:now%29%29"
Write-Highlight "[https://ELK-INSTANCE/app/discover#/]($($elk_link))"

Hi @gunfigther,

Thank you for the quick response.

I had a go at this in a test instance and I wasn’t able to get this to work either with the parentheses ( ). As you mentioned, I was able to get the URL to work as expected with the URL escaped ASCII characters, but I don’t have a way to test if this resolves correctly.

Have you tried using %23 in place of any # characters?

Unfortunately, with such a complicated URL, this is likely just a trial and error situation. You may even need to consider using URL escaped ASCII on any non-alphabet characters (aside from /).

Let me know if trying the above gets you any closer.

Best Regards,
Donny Bell

Thanks for the advice, it really helped. The problem was the presence of the $ character in string (in my example above it’s $state), which the powershell interpreted as the name of a variable with an empty value.
I changed it to %24 and URL started working as it should!

1 Like