Closed zefhemel closed 5 months ago
Implementation of replace
is here: https://github.com/silverbulletmd/silverbullet/blob/main/lib/builtin_query_functions.ts#L8
Are you considering also allowing regex in the second argument of the replacement function?
I still don't know what that would do. I don't know of any regex library that supports this. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
I still don't know what that would do. I don't know of any regex library that supports this. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
The idea would be to have replacements like this below, to avoid the need of making several pair-replacements
replace(readPage(name),/(\w+)(@)/,/\[\[$1\]\]/)
You can already do that, just use " quotes instead of / in the second argument. "[[$1]]"
You can already do that, just use " quotes instead of / in the second argument.
"[[$1]]"
Oh, I didn't realize that.
I just tried it and it works, it replaced the name@ correctly with [[name]] values. However, these [[name]] results are not clickable.
Any chance to fix that?
UPDATE: Easy fix, i didn't need to escape the "[" characters
So that @paletochen doesn't have to nest them 10 levels deep.