Commands
This reference documents how to interact with the Typst compiler.
Typstry.Commands.TypstCommandErrors.TypstCommandError
— TypeTypstCommandError <: Exception
TypstCommandError(::TypstCommand)
An Exception
indicating a Typst comand-line interface error from running a TypstCommand
.
Interface
Implements the Exception
interface.
showerror(::IO, ::TypstCommandError)
show(::IO, ::MIME"text/plain", ::TypstCommandError)
Examples
julia> TypstCommandError(typst``)
TypstCommandError(typst``)
Typstry.Commands.TypstCommands.TypstCommand
— TypeTypstCommand(::AbstractVector{<:AbstractString})
TypstCommand(::TypstCommand; kwargs...)
The Typst compiler and its parameters.
Keyword parameters have the same semantics as for a Cmd
.
Interface
This type implements the Cmd
interface. However, the interface is undocumented, which may result in unexpected behavior.
addenv(::TypstCommand, env...; inherit::Bool = true)
- Can be used with
julia_mono
.
- Can be used with
detach(::TypstCommand)
eltype(::Type{TypstCommand})
firstindex(::TypstCommand)
getindex(::TypstCommand, i)
hash(::TypstCommand, ::UInt)
ignorestatus(::TypstCommand)
- Do not throw a
TypstCommandError
if the Typst compiler throws an error. Errors thrown by the Typst compiler are printed tostderr
regardless.
- Do not throw a
iterate(::TypstCommand, i)
iterate(::TypstCommand)
keys(::TypstCommand)
lastindex(::TypstCommand)
length(::TypstCommand)
read(::TypstCommand, ::Type{String})
read(::TypstCommand)
run(::TypstCommand, args...; wait::Bool = true)
- Errors thrown by the Typst compiler will be printed to
stderr
. Then, a JuliaTypstCommandError
will be thrown unless theignorestatus
flag is set.
- Errors thrown by the Typst compiler will be printed to
setcpuaffinity(::TypstCommand, cpus)
setenv(::TypstString, env...; kwargs...)
- Can be used with
julia_mono
.
- Can be used with
show(::IO, ::MIME"text/plain", ::TypstCommand)
Examples
julia> help = TypstCommand(["help"])
typst`help`
julia> TypstCommand(help; ignorestatus = true)
typst`help`
Typstry.Commands.TypstCommands.@typst_cmd
— Macro@typst_cmd("")
typst``
Construct a TypstCommand
where each parameter is separated by a space.
This does not yet support interpolation; use the constructor instead.
Examples
julia> typst`help`
typst`help`
julia> typst`compile input.typ output.typ`
typst`compile input.typ output.typ`
Typstry.Commands.julia_mono
— Constantjulia_mono
A constant String
file path to the JuliaMono typeface.
This typeface is available when using one of the following approaches:
TypstCommand(["compile", "input.typ", "output.pdf", "--font-path=" * julia_mono])
addenv(::TypstCommand, "TYPST_FONT_PATHS" => julia_mono)
setenv(::TypstCommand, "TYPST_FONT_PATHS" => julia_mono)
ENV["TYPST_FONT_PATHS"] = julia_mono
and when compiling documents with the following methods:
render
typst
show
with theapplication/pdf
,image/png
, andimage/svg+xml
MIME
types and aTypstString
,TypstText
, andTypst
value
See also TypstCommand
.
Typstry.Commands.typst
— Functiontypst(::AbstractString; catch_interrupt::Bool = true, ignorestatus::Bool = true)
Convenience function intended for interactive use, emulating the typst command line interface.
If the "TYPST_FONT_PATHS"
environment variable is not set, it is temporarily set to julia_mono
.
It strictly splits on spaces and does not provide any shell-style escape mechanism, so it will not work if there are, e.g., filenames with spaces.
Parameters
catch_interrupt::Bool = true
[CTRL]+[C]
quietly quits the command.
ignorestatus::Bool = true
- Whether to throw a
TypstCommandError
if the command errors.
- Whether to throw a