diff --git a/development/.documenter-siteinfo.json b/development/.documenter-siteinfo.json index 9da01fd..09eff96 100644 --- a/development/.documenter-siteinfo.json +++ b/development/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-20T19:57:01","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-20T20:04:30","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/development/guides/package_interoperability/index.html b/development/guides/package_interoperability/index.html index c90c616..d13930d 100644 --- a/development/guides/package_interoperability/index.html +++ b/development/guides/package_interoperability/index.html @@ -15,4 +15,4 @@ julia> TypstJlyfish.compile("typst_jlyfish.typ"; evaluation_file = "typst_jlyfish.json", typst_compile_args = "--format=svg --font-path=$julia_mono" - ) + ) diff --git a/development/guides/the_julia_to_typst_interface/index.html b/development/guides/the_julia_to_typst_interface/index.html index ba015ac..26885c0 100644 --- a/development/guides/the_julia_to_typst_interface/index.html +++ b/development/guides/the_julia_to_typst_interface/index.html @@ -66,4 +66,4 @@ range(0, 7, step: 2) julia> println(TypstString(0:2.0:6; mode = code)) -(0.0, 2.0, 4.0, 6.0) +(0.0, 2.0, 4.0, 6.0) diff --git a/development/guides/typst_formatting_examples/index.html b/development/guides/typst_formatting_examples/index.html index 6c4ea87..95b9b55 100644 --- a/development/guides/typst_formatting_examples/index.html +++ b/development/guides/typst_formatting_examples/index.html @@ -1,2 +1,2 @@ -Typst Formatting Examples · Typstry.jl

Typst Formatting Examples

This guide illustrates Typst formatting for supported types.

These Typst documents were generated from Julia using show with the text/typst MIME type and compiled using a TypstCommand. Each row corresponds to a method of show_typst. The Typst columns contain the code, markup, and math syntactical Modes. Each mode contains two columns, where the first is the Typst source text and the second is how that text is rendered in a compiled document. Sequential documents correspond to Package Extensions.

Tip

Open these images in a new tab or another viewer.

Typstry.jl examples LaTeXStrings.jl examples Markdown.jl examples

+Typst Formatting Examples · Typstry.jl

Typst Formatting Examples

This guide illustrates Typst formatting for supported types.

These Typst documents were generated from Julia using show with the text/typst MIME type and compiled using a TypstCommand. Each row corresponds to a method of show_typst. The Typst columns contain the code, markup, and math syntactical Modes. Each mode contains two columns, where the first is the Typst source text and the second is how that text is rendered in a compiled document. Sequential documents correspond to Package Extensions.

Tip

Open these images in a new tab or another viewer.

Typstry.jl examples LaTeXStrings.jl examples Markdown.jl examples

diff --git a/development/index.html b/development/index.html index 3f31647..cc7ec04 100644 --- a/development/index.html +++ b/development/index.html @@ -27,4 +27,4 @@ julia> render(1:4);

Features

Strings

Commands

Planned

Similar Packages

Typst

Typst and LaTeX

LaTeX

+typst"(a b)"

Similar Packages

Typst

Typst and LaTeX

LaTeX

diff --git a/development/references/commands/index.html b/development/references/commands/index.html index b6e90b3..29dd18c 100644 --- a/development/references/commands/index.html +++ b/development/references/commands/index.html @@ -4,42 +4,42 @@ typst`help` julia> TypstCommand(help; ignorestatus = true) -typst`help`source
Typstry.Commands.TypstErrorType
TypstError <: Exception
-TypstError(::TypstCommand)

An Exception indicating a failure to run a TypstCommand.

source
Typstry.Commands.@typst_cmdMacro
@typst_cmd("s")
+typst`help`
source
Typstry.Commands.TypstErrorType
TypstError <: Exception
+TypstError(::TypstCommand)

An Exception indicating a failure to run a TypstCommand.

source
Typstry.Commands.@typst_cmdMacro
@typst_cmd("s")
 typst`s`

Construct a TypstCommand where each parameter is separated by a space.

This does not 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`
source
Typstry.Commands.julia_monoConstant
julia_mono

A constant String file path to the JuliaMono typeface.

Use with a TypstCommand and one of addenv, setenv, or the font-path Typst command-line option.

source
Typstry.Commands.preambleConstant
preamble

A constant TypstString used at the beginning of Typst source files.

Examples

julia> println(Typstry.Commands.preamble)
+typst`compile input.typ output.typ`
source
Typstry.Commands.julia_monoConstant
julia_mono

A constant String file path to the JuliaMono typeface.

Use with a TypstCommand and one of addenv, setenv, or the font-path Typst command-line option.

source
Typstry.Commands.preambleConstant
preamble

A constant TypstString used at the beginning of Typst source files.

Examples

julia> println(Typstry.Commands.preamble)
 #set page(margin: 1em, height: auto, width: auto, fill: white)
-#set text(16pt, font: "JuliaMono")
source
Typstry.Commands.renderFunction
render(x;
+#set text(16pt, font: "JuliaMono")
source
Typstry.Commands.renderFunction
render(x;
     input = "input.typ",
     output = "output.pdf",
     open = true,
     preamble = preamble,
-context...)

Render to a document using show(::IO, ::MIME"text/typst", ::Typst).

This first generates the input file containing the preamble and formatted value. Then it is compiled to the output document, whose format is inferred by its file extension to be pdf, png, or svg. The document may be automatically opened by the default viewer.

Examples

julia> render(Any[true 1; 1.2 1 // 2]);
source

Base

Base.:==Function
==(::TypstCommand, ::TypstCommand)

See also TypstCommand.

Examples

julia> TypstCommand(["help"]) == @typst_cmd("help") == typst`help`
+context...)

Render to a document using show(::IO, ::MIME"text/typst", ::Typst).

This first generates the input file containing the preamble and formatted value. Then it is compiled to the output document, whose format is inferred by its file extension to be pdf, png, or svg. The document may be automatically opened by the default viewer.

Examples

julia> render(Any[true 1; 1.2 1 // 2]);
source

Base

Base.:==Function
==(::TypstCommand, ::TypstCommand)

See also TypstCommand.

Examples

julia> TypstCommand(["help"]) == @typst_cmd("help") == typst`help`
 true
 
 julia> typst`help` == ignorestatus(typst`help`)
-false
source
Base.addenvFunction
addenv(::TypstCommand, args...; kwargs...)

See also TypstCommand and julia_mono.

Examples

julia> addenv(typst`compile input.typ output.pdf`, "TYPST_FONT_PATHS" => julia_mono)
-typst`compile input.typ output.pdf`
source
Base.detachFunction
detach(::TypstCommand)

See also TypstCommand.

Examples

julia> detach(typst`help`)
-typst`help`
source
Base.eltypeFunction
eltype(::Type{TypstCommand})

See also TypstCommand.

Examples

julia> eltype(TypstCommand)
-String
source
Base.firstindexFunction
firstindex(::TypstCommand)

See also TypstCommand.

Examples

julia> firstindex(typst`help`)
-1
source
Base.getindexFunction
getindex(::TypstCommand, i)

See also TypstCommand.

Examples

julia> typst`help`[2]
-"help"
source
Base.hashFunction
hash(::TypstCommand, ::UInt)

See also TypstCommand.

source
Base.ignorestatusFunction
ignorestatus(::TypstCommand)

Return a TypstCommand that does not throw a TypstError if the Typst compiler throws an error.

Errors thrown by the Typst compiler are printed to stderr regardless.

Examples

julia> ignorestatus(typst`help`)
-typst`help`
source
Base.iterateMethod
iterate(::TypstCommand)
+false
source
Base.addenvFunction
addenv(::TypstCommand, args...; kwargs...)

See also TypstCommand and julia_mono.

Examples

julia> addenv(typst`compile input.typ output.pdf`, "TYPST_FONT_PATHS" => julia_mono)
+typst`compile input.typ output.pdf`
source
Base.detachFunction
detach(::TypstCommand)

See also TypstCommand.

Examples

julia> detach(typst`help`)
+typst`help`
source
Base.eltypeFunction
eltype(::Type{TypstCommand})

See also TypstCommand.

Examples

julia> eltype(TypstCommand)
+String
source
Base.firstindexFunction
firstindex(::TypstCommand)

See also TypstCommand.

Examples

julia> firstindex(typst`help`)
+1
source
Base.getindexFunction
getindex(::TypstCommand, i)

See also TypstCommand.

Examples

julia> typst`help`[2]
+"help"
source
Base.hashFunction
hash(::TypstCommand, ::UInt)

See also TypstCommand.

source
Base.ignorestatusFunction
ignorestatus(::TypstCommand)

Return a TypstCommand that does not throw a TypstError if the Typst compiler throws an error.

Errors thrown by the Typst compiler are printed to stderr regardless.

Examples

julia> ignorestatus(typst`help`)
+typst`help`
source
Base.iterateMethod
iterate(::TypstCommand)
 iterate(::TypstCommand, i)

See also TypstCommand.

Examples

julia> iterate(typst`help`, 2)
 ("help", 3)
 
-julia> iterate(typst`help`, 3)
source
Base.keysFunction
keys(::TypstCommand)

See also TypstCommand.

Examples

julia> keys(typst`help`)
+julia> iterate(typst`help`, 3)
source
Base.keysFunction
keys(::TypstCommand)

See also TypstCommand.

Examples

julia> keys(typst`help`)
 2-element LinearIndices{1, Tuple{Base.OneTo{Int64}}}:
  1
- 2
source
Base.lastindexFunction
lastindex(::TypstCommand)

See also TypstCommand.

Examples

julia> lastindex(typst`help`)
-2
source
Base.lengthFunction
length(::TypstCommand)

See also TypstCommand.

Examples

julia> length(typst`help`)
-2
source
Base.runFunction
run(::TypstCommand, args...; kwargs...)

See also TypstCommand.

Info

Errors thrown by the Typst compiler will be printed to stderr. Then, a Julia TypstError will be thrown unless the ignorestatus flag is set.

source
Base.setcpuaffinityFunction
setcpuaffinity(::TypstCommand, cpus)

See also TypstCommand.

Examples

julia> setcpuaffinity(typst`help`, nothing)
-typst`help`
source
Base.setenvFunction
setenv(::TypstCommand, args...; kwargs...)

See also TypstCommand and julia_mono.

Examples

julia> setenv(typst`compile input.typ output.pdf`, "TYPST_FONT_PATHS" => julia_mono)
-typst`compile input.typ output.pdf`
source
Base.showMethod
show(::IO, ::MIME"text/plain", ::TypstCommand)

See also TypstCommand.

Examples

julia> show(stdout, "text/plain", typst`help`)
-typst`help`
source
Base.showMethod
show(::IO, ::Union{
+ 2
source
Base.lastindexFunction
lastindex(::TypstCommand)

See also TypstCommand.

Examples

julia> lastindex(typst`help`)
+2
source
Base.lengthFunction
length(::TypstCommand)

See also TypstCommand.

Examples

julia> length(typst`help`)
+2
source
Base.runFunction
run(::TypstCommand, args...; kwargs...)

See also TypstCommand.

Info

Errors thrown by the Typst compiler will be printed to stderr. Then, a Julia TypstError will be thrown unless the ignorestatus flag is set.

source
Base.setcpuaffinityFunction
setcpuaffinity(::TypstCommand, cpus)

See also TypstCommand.

Examples

julia> setcpuaffinity(typst`help`, nothing)
+typst`help`
source
Base.setenvFunction
setenv(::TypstCommand, args...; kwargs...)

See also TypstCommand and julia_mono.

Examples

julia> setenv(typst`compile input.typ output.pdf`, "TYPST_FONT_PATHS" => julia_mono)
+typst`compile input.typ output.pdf`
source
Base.showMethod
show(::IO, ::MIME"text/plain", ::TypstCommand)

See also TypstCommand.

Examples

julia> show(stdout, "text/plain", typst`help`)
+typst`help`
source
Base.showMethod
show(::IO, ::Union{
     MIME"application/pdf", MIME"image/png", MIME"image/svg+xml"
-}, ::Union{Typst, TypstString, TypstText})

Print the Portable Document Format (PDF), Portable Network Graphics (PNG), or Scalable Vector Graphics (SVG) format.

The preamble keyword parameter used by render may be specified in an IOContext. Environments, such as Pluto.jl notebooks, may use these methods to display values of type Typst, TypstString, and TypstText.

Examples

julia> show(IOContext(devnull, :preamble => typst""), "image/svg+xml", Typst(1));
source
Base.showerrorFunction
showerror(::IO, ::TypstError)

Print a TypstError when failing to run a TypstCommand.

Examples

julia> showerror(stdout, TypstError(typst``))
-TypstError: failed to `run` a `TypstCommand(String[])`
source
+}, ::Union{Typst, TypstString, TypstText})

Print the Portable Document Format (PDF), Portable Network Graphics (PNG), or Scalable Vector Graphics (SVG) format.

The preamble keyword parameter used by render may be specified in an IOContext. Environments, such as Pluto.jl notebooks, may use these methods to display values of type Typst, TypstString, and TypstText.

Examples

julia> show(IOContext(devnull, :preamble => typst""), "image/svg+xml", Typst(1));
source
Base.showerrorFunction
showerror(::IO, ::TypstError)

Print a TypstError when failing to run a TypstCommand.

Examples

julia> showerror(stdout, TypstError(typst``))
+TypstError: failed to `run` a `TypstCommand(String[])`
source
diff --git a/development/references/internals/index.html b/development/references/internals/index.html index 0e1a6f4..2c59e71 100644 --- a/development/references/internals/index.html +++ b/development/references/internals/index.html @@ -1,53 +1,53 @@ -Internals · Typstry.jl

Internals

This reference documents non-public utilities.

Typstry.compile_workloadFunction
compile_workload(examples)

Given an iterable of value-type pairs, interpolate each value into a @typst_str within a PrecompileTools.@compile_workload block.

source

Strings

Typstry.StringsModule
Strings

The Julia to Typst interface, a custom string corresponding to Typst source text, and its implementation of the String interface.

Examples

julia> Typstry.Strings
-Typstry.Strings
source
Typstry.Strings.backticksFunction
backticks(io)

Return to io[:backticks]::Int.

Examples

julia> Typstry.Strings.backticks(IOContext(stdout, :backticks => 3))
-3
source
Typstry.Strings.blockFunction
block(io)

Return io[:block]::Bool.

Examples

julia> Typstry.Strings.block(IOContext(stdout, :block => true))
-true
source
Typstry.Strings.code_modeFunction
code_mode(io)

Print the number sign, unless mode(io) == code.

See also Mode and mode.

Examples

julia> Typstry.Strings.code_mode(IOContext(stdout, :mode => code))
+Internals · Typstry.jl

Internals

This reference documents non-public utilities.

Typstry.compile_workloadFunction
compile_workload(examples)

Given an iterable of value-type pairs, interpolate each value into a @typst_str within a PrecompileTools.@compile_workload block.

source

Strings

Typstry.StringsModule
Strings

The Julia to Typst interface, a custom string corresponding to Typst source text, and its implementation of the String interface.

Examples

julia> Typstry.Strings
+Typstry.Strings
source
Typstry.Strings.backticksFunction
backticks(io)

Return to io[:backticks]::Int.

Examples

julia> Typstry.Strings.backticks(IOContext(stdout, :backticks => 3))
+3
source
Typstry.Strings.blockFunction
block(io)

Return io[:block]::Bool.

Examples

julia> Typstry.Strings.block(IOContext(stdout, :block => true))
+true
source
Typstry.Strings.code_modeFunction
code_mode(io)

Print the number sign, unless mode(io) == code.

See also Mode and mode.

Examples

julia> Typstry.Strings.code_mode(IOContext(stdout, :mode => code))
 
 julia> Typstry.Strings.code_mode(IOContext(stdout, :mode => markup))
 #
 
 julia> Typstry.Strings.code_mode(IOContext(stdout, :mode => math))
-#
source
Typstry.Strings.depthFunction
depth(io)

Return io[:depth]::Int.

Examples

julia> Typstry.Strings.depth(IOContext(stdout, :depth => 0))
-0
source
Typstry.Strings.encloseFunction
enclose(f, io, x, left, right = reverse(left); kwargs...)

Call f(io, x; kwargs...) between printing left and right, respectfully.

Examples

julia> Typstry.Strings.enclose((io, i; x) -> print(io, i, x), stdout, 1, "\$ "; x = "x")
-$ 1x $
source
Typstry.Strings.join_withFunction
join_with(f, io, xs, delimeter; kwargs...)

Similar to join, except printing with f(io, x; kwargs...).

Examples

julia> Typstry.Strings.join_with((io, i; x) -> print(io, -i, x), stdout, 1:4, ", "; x = "x")
--1x, -2x, -3x, -4x
source
Typstry.Strings.math_padFunction
math_pad(io)

Return "", "\$", or "\$ " depending on the block and mode settings.

Examples

julia> Typstry.Strings.math_pad(IOContext(stdout, :mode => math))
+#
source
Typstry.Strings.depthFunction
depth(io)

Return io[:depth]::Int.

Examples

julia> Typstry.Strings.depth(IOContext(stdout, :depth => 0))
+0
source
Typstry.Strings.encloseFunction
enclose(f, io, x, left, right = reverse(left); kwargs...)

Call f(io, x; kwargs...) between printing left and right, respectfully.

Examples

julia> Typstry.Strings.enclose((io, i; x) -> print(io, i, x), stdout, 1, "\$ "; x = "x")
+$ 1x $
source
Typstry.Strings.join_withFunction
join_with(f, io, xs, delimeter; kwargs...)

Similar to join, except printing with f(io, x; kwargs...).

Examples

julia> Typstry.Strings.join_with((io, i; x) -> print(io, -i, x), stdout, 1:4, ", "; x = "x")
+-1x, -2x, -3x, -4x
source
Typstry.Strings.math_padFunction
math_pad(io)

Return "", "\$", or "\$ " depending on the block and mode settings.

Examples

julia> Typstry.Strings.math_pad(IOContext(stdout, :mode => math))
 ""
 
 julia> Typstry.Strings.math_pad(IOContext(stdout, :block => true, :mode => markup))
 "\$ "
 
 julia> Typstry.Strings.math_pad(IOContext(stdout, :block => false, :mode => markup))
-"\$"
source
Typstry.Strings.maybe_wrapFunction
maybe_wrap(::Any)

Wrap the value in Typst unless it is a TypstString or TypstText.

Examples

julia> Typstry.Strings.maybe_wrap(1)
 Typst{Int64}(1)
 
 julia> Typstry.Strings.maybe_wrap(TypstString(1))
 typst"$1$"
 
 julia> Typstry.Strings.maybe_wrap(TypstText(1))
-TypstText{Int64}(1)
source
Typstry.Strings.modeFunction
mode(io)

Return io[:mode]::Mode.

See also Mode.

Examples

julia> Typstry.Strings.mode(IOContext(stdout, :mode => code))
-code::Mode = 0
source
Typstry.Strings.parenthesizeFunction
parenthesize(io)

Return io[:parenthesize]::Bool.

Examples

julia> Typstry.Strings.parenthesize(IOContext(stdout, :parenthesize => true))
-true
source
Typstry.Strings.modeFunction
mode(io)

Return io[:mode]::Mode.

See also Mode.

Examples

julia> Typstry.Strings.mode(IOContext(stdout, :mode => code))
+code::Mode = 0
source
Typstry.Strings.parenthesizeFunction
parenthesize(io)

Return io[:parenthesize]::Bool.

Examples

julia> Typstry.Strings.parenthesize(IOContext(stdout, :parenthesize => true))
+true
source
Typstry.Strings.show_parametersFunction
show_parameters(io, f, keys, final)

Examples

julia> Typstry.Strings.show_parameters(
            IOContext(stdout, :depth => 0, :tab_size => 2, :delim => typst"\"(\""),
        "vec", [:delim, :gap], true)
 vec(
-  delim: "(",
source

Dates.jl

Info

A Dates.jl package extension would currently print warnings during precompilation. See also the Julia issue #52511

Dates.jl

Info

A Dates.jl package extension would currently print warnings during precompilation. See also the Julia issue #52511

Typstry.Strings.durationFunction
duration(::Dates.Period)

Examples

julia> Typstry.Strings.duration(Dates.Day(1))
 :days
 
 julia> Typstry.Strings.duration(Dates.Hour(1))
-:hours
source
Typstry.Strings.datesFunction
dates(::Union{Dates.Date, Dates.DateTime, Dates.Period, Dates.Time})

Examples

julia> Typstry.Strings.dates(Dates.Date(1))
+:hours
source
Typstry.Strings.datesFunction
dates(::Union{Dates.Date, Dates.DateTime, Dates.Period, Dates.Time})

Examples

julia> Typstry.Strings.dates(Dates.Date(1))
 ("datetime", (:year, :month, :day), (1, 1, 1))
 
 julia> Typstry.Strings.dates(Dates.Day(1))
-("duration", (:days,), (TypstText{String}("1"),))
source

Commands

Typstry.CommandsModule
Commands

A custom command corresponding to the Typst compiler and its implementation of the Cmd interface.

Examples

julia> Typstry.Commands
-Typstry.Commands
source
Typstry.Commands.formatFunction
format(::Union{MIME"application/pdf", MIME"image/png", MIME"image/svg+xml"})

Return the image format acronym corresponding to the given MIME.

Examples

julia> Typstry.Commands.format(MIME"application/pdf"())
+("duration", (:days,), (TypstText{String}("1"),))
source

Commands

Typstry.CommandsModule
Commands

A custom command corresponding to the Typst compiler and its implementation of the Cmd interface.

Examples

julia> Typstry.Commands
+Typstry.Commands
source
Typstry.Commands.formatFunction
format(::Union{MIME"application/pdf", MIME"image/png", MIME"image/svg+xml"})

Return the image format acronym corresponding to the given MIME.

Examples

julia> Typstry.Commands.format(MIME"application/pdf"())
 "pdf"
 
 julia> Typstry.Commands.format(MIME"image/png"())
 "png"
 
 julia> Typstry.Commands.format(MIME"image/svg+xml"())
-"svg"
source
+"svg"
source
diff --git a/development/references/package_extensions/index.html b/development/references/package_extensions/index.html index 034ba08..6ecad15 100644 --- a/development/references/package_extensions/index.html +++ b/development/references/package_extensions/index.html @@ -1,2 +1,2 @@ -Package Extensions · Typstry.jl

Package Extensions

This reference documents the lazily-loaded implementations of show_typst for types defined in external packages.

LaTeXStrings.jl

Typstry.Strings.show_typstMethod
show_typst(io, ::LaTeXString)

Print in Typst format for LaTeXStrings.jl.

TypeSettingsParameters
LaTeXString:block, :depth, :mode, :tab_size
source

Markdown.jl

Typstry.Strings.show_typstMethod
show_typst(io, ::Markdown.MD)

Print in Typst format for Markdown.jl.

TypeSettingsParameters
Markdown.MD:block, :depth, :mode, :tab_size
source
+Package Extensions · Typstry.jl

Package Extensions

This reference documents the lazily-loaded implementations of show_typst for types defined in external packages.

LaTeXStrings.jl

Typstry.Strings.show_typstMethod
show_typst(io, ::LaTeXString)

Print in Typst format for LaTeXStrings.jl.

TypeSettingsParameters
LaTeXString:block, :depth, :mode, :tab_size
source

Markdown.jl

Typstry.Strings.show_typstMethod
show_typst(io, ::Markdown.MD)

Print in Typst format for Markdown.jl.

TypeSettingsParameters
Markdown.MD:block, :depth, :mode, :tab_size
source
diff --git a/development/references/strings/index.html b/development/references/strings/index.html index d7780d2..7ef7d08 100644 --- a/development/references/strings/index.html +++ b/development/references/strings/index.html @@ -3,22 +3,22 @@ Enum Mode: code = 0 markup = 1 -math = 2source
Typstry.Strings.TypstType
Typst{T}
+math = 2
source
Typstry.Strings.TypstType
Typst{T}
 Typst(::T)

A wrapper used to pass values to show(::IO, ::MIME"text/typst", ::Typst).

Examples

julia> Typst(1)
 Typst{Int64}(1)
 
 julia> Typst("a")
-Typst{String}("a")
source
Typstry.Strings.TypstStringType
TypstString <: AbstractString
+Typst{String}("a")
source
Typstry.Strings.TypstStringType
TypstString <: AbstractString
 TypstString(::Any; context...)

Format the value as a Typst formatted string.

Optional Julia settings and Typst parameters are passed to show(::IO, ::MIME"text/typst", ::Typst) in an IOContext. See also show_typst for a list of supported types.

Info

This type implements the String interface. However, the interface is undocumented, which may result in unexpected behavior.

Examples

julia> TypstString(1)
 typst"$1$"
 
 julia> TypstString(1 + 2im; mode = math)
-typst"(1 + 2i)"
source
Typstry.Strings.TypstTextType
TypstText{T}
+typst"(1 + 2i)"
source
Typstry.Strings.TypstTextType
TypstText{T}
 TypstText(::Any)

A wrapper whose show_typst method uses print.

Info

This may be used to insert control characters into a TypstString. Unescaped control characters in TypstStrings may break formatting in some environments, such as the REPL.

Examples

julia> TypstText(1)
 TypstText{Int64}(1)
 
 julia> TypstText("a")
-TypstText{String}("a")
source
Typstry.Strings.@typst_strMacro
@typst_str("s")
+TypstText{String}("a")
source
Typstry.Strings.@typst_strMacro
@typst_str("s")
 typst"s"

Construct a TypstString.

Control characters are escaped, except double quotation marks and backslashes in the same manner as @raw_str. Values may be interpolated by calling the TypstString constructor, except using a backslash instead of the type name. Interpolation syntax may be escaped in the same manner as quotation marks.

Tip

Print directly to an IO using show(::IO, ::MIME"text/typst", ::Typst).

See also the performance tip to Avoid string interpolation for I/O.

Examples

julia> x = 1;
 
 julia> typst"$ \(x; mode = math) / \(x + 1; mode = math) $"
@@ -31,32 +31,32 @@
 typst"(1 / 2)"
 
 julia> typst"\\(x)"
-typst"\\(x)"
source
Typstry.Strings.codeConstant
code

A Typst syntactical Mode prefixed by the number sign.

Examples

julia> code
-code::Mode = 0
source
Typstry.Strings.markupConstant
markup

A Typst syntactical Mode at the top-level of source text and enclosed within square brackets.

julia> markup
-markup::Mode = 1
source
Typstry.Strings.mathConstant
math

A Typst syntactical Mode enclosed within dollar signs.

julia> math
-math::Mode = 2
source
Typstry.Strings.contextFunction
context(x)

Provide formatting data for show(::IO, ::MIME"text/typst", ::Typst).

Implement this function for a custom type to specify its custom settings and parameters. Passing a value wrapped in Typst will merge! its custom context with defaults, such that the defaults may be overwritten. To be compatible with merging contexts and constructing an IOContext, methods must return an AbstractDict{Symbol}.

SettingDefaultTypeDescription
:backticks3IntThe number of backticks to enclose raw text markup, which may be increased to disambiguiate nested raw text.
:blockfalseBoolWhen :mode => math, specifies whether the enclosing dollar signs are padded with a space to render the element inline or its own block.
:depth0IntThe current level of nesting within container types to specify the degree of indentation.
:modemarkupModeThe current Typst syntactical context where code follows the number sign, markup is at the top-level and enclosed in square brackets, and math is enclosed in dollar signs.
:parenthesizetrueBoolWhether to enclose some mathematical elements in parentheses to specify their operator precedence and avoid ambiguity.
:tab_size2IntThe number of spaces used by some elements with multi-line Typst formatting, which is repeated for each level of depth
source
Typstry.Strings.show_typstMethod
show_typst(io, x)

Print in Typst format with Julia settings and Typst parameters provided by an IOContext.

Implement this function for a custom type to specify its Typst formatting. A setting is a value used in Julia, whose type varies across settings. A parameter is passed directly to a Typst function and must be a TypstString with the same name as in Typst, except that dashes are replaced with underscores. Settings each have a default value, whereas the default values of parameters are handled by Typst functions. Some settings, such as block, correspond with a parameter but may also be used in Julia.

For additional information on settings and parameters, see also context and the Typst Documentation, respectively.

Info

Some types, particularly containers, may call show(::IO, ::MIME"text/typst", ::Typst) to format a value, which may use additional settings and parameters.

Warning

This function's methods are incomplete. Please file an issue or create a pull-request for missing methods.

TypeSettingsParameters
AbstractArray:block, :depth, :mode, :tab_size:delim, :gap
AbstractChar
AbstractFloat:mode
AbstractMatrix:block, :depth, :mode, :tab_size:augment, :column_gap, :delim, :gap, :row_gap
AbstractString
Bool:mode
Complex{Bool}:block, :mode, :parenthesize
Complex:block, :mode, :parenthesize
Irrational:mode
Nothing:mode
OrdinalRange{<:Integer, <:Integer}:mode
Rational:block, :mode, :parenthesize
Regex:mode
Signed:mode
StepRangeLen{<:Integer, <:Integer, <:Integer}:mode
Tuple:block, :depth, :mode, :tab_size:delim, :gap
Typst
TypstString
TypstText:mode
Unsigned:mode
VersionNumber:mode
Docs.HTML:block, :depth, :mode, :tab_size
Docs.Text:mode
Dates.Date:mode, :indent
Dates.DateTime:mode, :indent
Dates.Period:mode, :indent
Dates.Time:mode, :indent
source

Base

Base.IOBufferType
IOBuffer(::TypstString)

See also TypstString.

Examples

julia> IOBuffer(typst"a")
-IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=1, maxsize=Inf, ptr=1, mark=-1)
source
Base.codeunitFunction
codeunit(::TypstString)
+typst"\\(x)"
source
Typstry.Strings.codeConstant
code

A Typst syntactical Mode prefixed by the number sign.

Examples

julia> code
+code::Mode = 0
source
Typstry.Strings.markupConstant
markup

A Typst syntactical Mode at the top-level of source text and enclosed within square brackets.

julia> markup
+markup::Mode = 1
source
Typstry.Strings.mathConstant
math

A Typst syntactical Mode enclosed within dollar signs.

julia> math
+math::Mode = 2
source
Typstry.Strings.contextFunction
context(x)

Provide formatting data for show(::IO, ::MIME"text/typst", ::Typst).

Implement this function for a custom type to specify its custom settings and parameters. Passing a value wrapped in Typst will merge! its custom context with defaults, such that the defaults may be overwritten. To be compatible with merging contexts and constructing an IOContext, methods must return an AbstractDict{Symbol}.

SettingDefaultTypeDescription
:backticks3IntThe number of backticks to enclose raw text markup, which may be increased to disambiguiate nested raw text.
:blockfalseBoolWhen :mode => math, specifies whether the enclosing dollar signs are padded with a space to render the element inline or its own block.
:depth0IntThe current level of nesting within container types to specify the degree of indentation.
:modemarkupModeThe current Typst syntactical context where code follows the number sign, markup is at the top-level and enclosed in square brackets, and math is enclosed in dollar signs.
:parenthesizetrueBoolWhether to enclose some mathematical elements in parentheses to specify their operator precedence and avoid ambiguity.
:tab_size2IntThe number of spaces used by some elements with multi-line Typst formatting, which is repeated for each level of depth
source
Typstry.Strings.show_typstMethod
show_typst(io, x)

Print in Typst format with Julia settings and Typst parameters provided by an IOContext.

Implement this function for a custom type to specify its Typst formatting. A setting is a value used in Julia, whose type varies across settings. A parameter is passed directly to a Typst function and must be a TypstString with the same name as in Typst, except that dashes are replaced with underscores. Settings each have a default value, whereas the default values of parameters are handled by Typst functions. Some settings, such as block, correspond with a parameter but may also be used in Julia.

For additional information on settings and parameters, see also context and the Typst Documentation, respectively.

Info

Some types, particularly containers, may call show(::IO, ::MIME"text/typst", ::Typst) to format a value, which may use additional settings and parameters.

Warning

This function's methods are incomplete. Please file an issue or create a pull-request for missing methods.

TypeSettingsParameters
AbstractArray:block, :depth, :mode, :tab_size:delim, :gap
AbstractChar
AbstractFloat:mode
AbstractMatrix:block, :depth, :mode, :tab_size:augment, :column_gap, :delim, :gap, :row_gap
AbstractString
Bool:mode
Complex{Bool}:block, :mode, :parenthesize
Complex:block, :mode, :parenthesize
Irrational:mode
Nothing:mode
OrdinalRange{<:Integer, <:Integer}:mode
Rational:block, :mode, :parenthesize
Regex:mode
Signed:mode
StepRangeLen{<:Integer, <:Integer, <:Integer}:mode
Tuple:block, :depth, :mode, :tab_size:delim, :gap
Typst
TypstString
TypstText:mode
Unsigned:mode
VersionNumber:mode
Docs.HTML:block, :depth, :mode, :tab_size
Docs.Text:mode
Dates.Date:mode, :indent
Dates.DateTime:mode, :indent
Dates.Period:mode, :indent
Dates.Time:mode, :indent
source

Base

Base.IOBufferType
IOBuffer(::TypstString)

See also TypstString.

Examples

julia> IOBuffer(typst"a")
+IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=1, maxsize=Inf, ptr=1, mark=-1)
source
Base.codeunitFunction
codeunit(::TypstString)
 codeunit(::TypstString, ::Integer)

See also TypstString.

Examples

julia> codeunit(typst"a")
 UInt8
 
 julia> codeunit(typst"a", 1)
-0x61
source
Base.isvalidFunction
isvalid(::TypstString, ::Integer)

See also TypstString.

Examples

julia> isvalid(typst"a", 1)
-true
source
Base.iterateMethod
iterate(::TypstString, ::Integer)
+0x61
source
Base.isvalidFunction
isvalid(::TypstString, ::Integer)

See also TypstString.

Examples

julia> isvalid(typst"a", 1)
+true
source
Base.iterateMethod
iterate(::TypstString, ::Integer)
 iterate(::TypstString)

See also TypstString.

Examples

julia> iterate(typst"a")
 ('a', 2)
 
 julia> iterate(typst"a", 1)
-('a', 2)
source
Base.ncodeunitsFunction
ncodeunits(::TypstString)

See also TypstString.

Examples

julia> ncodeunits(typst"a")
-1
source
Base.pointerFunction
pointer(::TypstString)

See also TypstString.

source
Base.reprFunction
repr(::MIME, ::TypstString; kwargs...)

See also TypstString.

Info

This method patches incorrect output from the assumption in repr that the parameter is already in the requested MIME type when the MIME type satisfies istextmime and the parameter is an AbstractString.

Examples

julia> repr("text/plain", typst"a")
+('a', 2)
source
Base.ncodeunitsFunction
ncodeunits(::TypstString)

See also TypstString.

Examples

julia> ncodeunits(typst"a")
+1
source
Base.pointerFunction
pointer(::TypstString)

See also TypstString.

source
Base.reprFunction
repr(::MIME, ::TypstString; kwargs...)

See also TypstString.

Info

This method patches incorrect output from the assumption in repr that the parameter is already in the requested MIME type when the MIME type satisfies istextmime and the parameter is an AbstractString.

Examples

julia> repr("text/plain", typst"a")
 "typst\"a\""
 
 julia> repr("text/typst", typst"a")
-typst"a"
source
Base.showMethod
show(::IO, ::TypstString)

See also TypstString.

Examples

julia> show(stdout, typst"a")
-typst"a"
source
Base.showMethod
show(::IO, ::MIME"text/typst", ::Union{Typst, TypstString, TypstText})

Print in Typst format.

This method provides formatting data to show_typst specified by a default and custom context.

See also Typst, TypstString, and TypstText.

Examples

julia> show(stdout, "text/typst", typst"a")
+typst"a"
source
Base.showMethod
show(::IO, ::TypstString)

See also TypstString.

Examples

julia> show(stdout, typst"a")
+typst"a"
source
Base.showMethod
show(::IO, ::MIME"text/typst", ::Union{Typst, TypstString, TypstText})

Print in Typst format.

This method provides formatting data to show_typst specified by a default and custom context.

See also Typst, TypstString, and TypstText.

Examples

julia> show(stdout, "text/typst", typst"a")
 a
 
 julia> show(stdout, "text/typst", Typst("a"))
 "a"
 
 julia> show(stdout, "text/typst", Typst(Text("a")))
-#"a"
source
+#"a"source diff --git a/development/tutorials/getting_started/index.html b/development/tutorials/getting_started/index.html index b1ce6ac..653d4d1 100644 --- a/development/tutorials/getting_started/index.html +++ b/development/tutorials/getting_started/index.html @@ -12,4 +12,4 @@ typst`help` julia> typst`compile input.typ output.pdf` -typst`compile input.typ output.pdf`

Easily generate a Typst source file and compile it into a document using render.

julia> render(Any[true 1; 1.2 1 // 2]);
+typst`compile input.typ output.pdf`

Easily generate a Typst source file and compile it into a document using render.

julia> render(Any[true 1; 1.2 1 // 2]);