Open Truncated opened 2 months ago
Pages are sanitized on their way in but it's not going to be looking for Obsidian scripts like that.
I will look into stripping those <%
bits out but tbh I'm surprised that Obsidian's own sanitization doesn't handle this.
I may be misunderstanding what you mean here, but I would greatly prefer not stripping anything out - the code was what I wanted to record, specifically. Is what you're talking about some kind of add / remove process where you sanitize the <% with some other characters and then find/replace them after they are on the page, where the end result is still the content but side-stepping the Templater eval process?
This specific parsing is from Templater, not Obsidian, so I wouldn't expect sanitization built-in.
It's probably something that would require integration effort from both slurp and Templater. I didn't see an API or integration section in their documentation, unfortunately, but I haven't checked the issues to see if this is a thing in closed or open issues.
Yeah I would sanitize those characters, ideally just by prefixing them with \
, before the page is written to prevent them from being evaluated.
This was fun. :)
I tried slurping this: https://forum.obsidian.md/t/create-file-after-choosing-a-folder/34311 The forums generally can't be targeted by Slurp effectively, but this one was a single post so I wanted to see if I could save the snippet.
I got a page, and immediately was prompted with the folder selection list that the templater example had. My Templater configuration does not have a configured folder overlapping the slurp directory, fwiw.
Page in slurped target folder:
Log - this test was controlled and prepped, but since the configuration doesn't have a clear log or insert break, I copied before and after and used Beyond Compare to find the new stuff.
1715273033628 | DEBUG | attempting to parse prop metadata
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | adding metadata
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | attempting to parse prop metadata
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | attempting to parse prop metadata
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | attempting to parse prop metadata
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | found prop elements
SlurpPlugin.slurp (plugin:slurp:12370:30)
1715273033628 | DEBUG | attempting to parse prop metadata
SlurpPlugin.slurp (plugin:slurp:12370:30)