I’m trying to make a custom string macro that effectively adds some initial boilerplate to the start of a Typst string.
The effect would be
julia> T"important" == typst"""
#set `some pretty rule`
important
"""
true
I think the main problem is that I can’t seem “hijack” the @typst_str
macro, meaning I cant send my string to the macro as a string, it always interperets it as a macro
macro T_str(s::String)
s = "#set `some pretty rule` \n" * s
@typst_str(s)
end
MethodError: no method matching var"@typst_str"(::LineNumberNode, ::Module, ::Expr)
My current workaround is to just copy the source code for the @typst_str
macro and add a line at the top but that seems bad long term in the event of an update to Typstry.jl