Escape characters in Kirbytext/Kirbytags attributes

Example: 1

Input:

(link:# text:text: example)

OR

(link:# text:text:example)

output:

<a href="#">text</a>

Example: 2

Input:

(link:# text: text: example)

output:

<a href="#">example</a>

So the problem might be quit obvious, how to escape the special characters? (I believe brackets are already taken care of, but not the ‘colon’)

I tried with backslash or encasing the entire string in quotes. The quotes are straightup ignored (single-, double-quots, backticks, neither work). The backslash does work but not entirely:

Input:

(link:# text: text\: example)

output:

<a href="#">text\: example</a>

It simply forgets to strip the escaping backslash in the endresult.

Any ideas/workarounds for this?

Try htmlentities:

text&#58;

Alright that’ll do.

Just out of curious, I use attributes for inline styles (for if one needs it). HTMLentities are not parsed correctly in css unfortunately.

I can implement my own ‘escape mechanism’, but it would be great if kirby can take care of it. I know there is the ‘escape’ function which will convert to HTMLentities, but is there an ‘unescape mechanism’ implemented?

Not Kirby but PHP

html_entity_decode()