Internals
This reference documents non-public utilities.
A Dates.jl package extension would currently print warnings during precompilation. See also the Julia issue #52511
Typstry.examples
— Constantexamples
A constant Vector
of Julia values and their corresponding Type
s implemented for show_typst
.
Contexts
Typstry.default_context
— Constantdefault_context
Utilities
Typstry.compile_workload
— Functioncompile_workload(examples)
Given an iterable of value-type pairs, interpolate each value into a @typst_str
within a PrecompileTools.@compile_workload
block.
Typstry.enclose
— Functionenclose(f, io, x, left, right = reverse(left); kwargs...)
Call f(io, x; kwargs...)
between printing left
and right
, respectfully.
Examples
julia> Typstry.enclose((io, i; x) -> print(io, i, x), stdout, 1, "\$ "; x = "x")
$ 1x $
Typstry.join_with
— Functionjoin_with(f, io, xs, delimeter; kwargs...)
Similar to join
, except printing with f(io, x; kwargs...)
.
Examples
julia> Typstry.join_with((io, i; x) -> print(io, -i, x), stdout, 1:4, ", "; x = "x")
-1x, -2x, -3x, -4x
Typstry.unwrap
— Functionunwrap(x, key::Symbol, default)
unwrap(x, type::Type, key)
Strings
Typstry.code_mode
— FunctionTypstry.date_time
— Functiondate_time(::Union{Dates.Date, Dates.Time, Dates.DateTime})
Typstry.dates
— Functiondates(::Union{Dates.Date, Dates.DateTime, Dates.Period, Dates.Time})
Examples
julia> Typstry.dates(Dates.Date(1))
("datetime", (:year, :month, :day), (1, 1, 1))
julia> Typstry.dates(Dates.Day(1))
("duration", (:days,), (TypstText{String}("1"),))
Typstry.duration
— Functionduration(::Dates.Period)
Examples
julia> Typstry.duration(Dates.Day(1))
:days
julia> Typstry.duration(Dates.Hour(1))
:hours
Typstry.escape
— Functionescape(io, n)
Print \
to io
n
times.
Examples
julia> Typstry.escape(stdout, 2)
\\
Typstry.format
— Functionformat(::Union{MIME"application/pdf", MIME"image/png", MIME"image/svg+xml"})
Return the image format acronym corresponding to the given MIME
.
Examples
julia> Typstry.format(MIME"application/pdf"())
"pdf"
julia> Typstry.format(MIME"image/png"())
"png"
julia> Typstry.format(MIME"image/svg+xml"())
"svg"
Typstry.indent
— Functionindent(tc)
Typstry.math_mode
— Functionmath_mode(f, io, tc, x; kwargs...)
Typstry.math_pad
— FunctionTypstry.show_parameters
— Functionshow_parameters(io, tc, f, keys, final)
Typstry.show_raw
— Functionshow_raw(::IO, ::TypstContext, ::MIME, ::Symbol, x)
Typstry.backticks
— Functionbackticks(tc, type, key)
Typstry.block
— Functionblock(tc, type, key)
Typstry.depth
— Functiondepth(tc, type, key)
Typstry.io
— Functionio(tc, type, key)
Typstry.mode
— Functionmode(tc, type, key)
Typstry.parenthesize
— Functionparenthesize(tc, type, key)
Typstry.preamble
— Functionpreamble(tc, type, key)
Typstry.tab_size
— Functiontab_size(tc, type, key)