obsidian-execute-code
obsidian-execute-code copied to clipboard
Better Magic Parsing
Right now, @show(...)
and @html(...)
use regex. This limits their applicability.
A simple contextual parser would help
- Allow more complex dynamic calculations (e.g.
@show("~/pictures/" + folder + "/img.png")
) - Prevent a bug where strings containing the commands (e.g.
console.log("@show(foo)")
get replaced with the injected code - Allow more complex magic functions
I think this would be really cool, but we need an efficient parser, otherwise long outputs will get really laggy
I agree about the importance of performance. I think we would only need a single-pass parser, which shouldn't be that laggy. As long as it's aware of the current position, quote depth, etc. we wouldn't need something complex.
Once I finish #103, I can test a simple parser.