From fb0668d624f83cfb079bf20af62c355f114d824d Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Mon, 28 Oct 2024 03:51:14 +0000 Subject: [PATCH] build based on 3525925 --- development/.documenter-siteinfo.json | 2 +- .../package_interoperability/index.html | 2 +- .../the_julia_to_typst_interface/index.html | 2 +- .../typst_formatting_examples/index.html | 2 +- development/index.html | 2 +- development/references/commands/index.html | 46 +++++++++---------- development/references/internals/index.html | 40 ++++++++-------- .../references/package_extensions/index.html | 2 +- development/references/strings/index.html | 38 +++++++-------- .../tutorials/getting_started/index.html | 2 +- 10 files changed, 69 insertions(+), 69 deletions(-) diff --git a/development/.documenter-siteinfo.json b/development/.documenter-siteinfo.json index e822b39..ed49d41 100644 --- a/development/.documenter-siteinfo.json +++ b/development/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-28T03:34:37","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-28T03:51:09","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 3e41dd4..92cbe91 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 1310eb6..d4fbfeb 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 eb6549b..292c48b 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 12f66f3..5466e0c 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 7977090..611bfa4 100644 --- a/development/references/commands/index.html +++ b/development/references/commands/index.html @@ -4,44 +4,44 @@ typst`help` julia> TypstCommand(help; ignorestatus = true) -typst`help`source
Typstry.Commands.TypstErrorType
TypstError <: Exception
+typst`help`
source
Typstry.Commands.TypstErrorType
TypstError <: Exception
 TypstError(::TypstCommand)

An Exception indicating a failure to run a TypstCommand.

Examples

julia> TypstError(typst``)
-TypstError(typst``)
source
Typstry.Commands.@typst_cmdMacro
@typst_cmd("s")
+TypstError(typst``)
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 generated by render and some show methods.

May be configured using set_preamble.

Examples

julia> preamble
-TypstString(TypstText("#set page(margin: 1em, height: auto, width: auto, fill: white)\n#set text(16pt, font: \"JuliaMono\")\n"))
source
Typstry.Commands.renderFunction
render(x;
+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 generated by render and some show methods.

May be configured using set_preamble.

Examples

julia> preamble
+TypstString(TypstText("#set page(margin: 1em, height: auto, width: auto, fill: white)\n#set text(16pt, font: \"JuliaMono\")\n"))
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
Typstry.Commands.set_preambleFunction
set_preamble()
-set_preamble(::TypstString)

Use Preferences.jl such that after restarting Julia, the preamble is initialized to the given TypstString.

If the TypstString is not provided, reset the preamble to it's default value.

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
Typstry.Commands.set_preambleFunction
set_preamble()
+set_preamble(::TypstString)

Use Preferences.jl such that after restarting Julia, the preamble is initialized to the given TypstString.

If the TypstString is not provided, reset the preamble to it's default value.

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, ::MIME"text/plain", ::TypstError)

Examples

julia> show(stdout, "text/plain", TypstError(typst``))
-TypstError(typst``)
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, ::MIME"text/plain", ::TypstError)

Examples

julia> show(stdout, "text/plain", TypstError(typst``))
+TypstError(typst``)
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.showerrorMethod
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.showerrorMethod
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 bfc2362..b328f61 100644 --- a/development/references/internals/index.html +++ b/development/references/internals/index.html @@ -1,47 +1,47 @@ -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.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.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.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.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.modeFunction
mode(io)

Examples

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

Examples

julia> Typstry.Strings.mode(IOContext(stdout, :mode => code))
+code::Mode = 0
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 88e43bf..4df3064 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 0a0c5ad..7d83622 100644 --- a/development/references/strings/index.html +++ b/development/references/strings/index.html @@ -1,26 +1,26 @@ Strings · Typstry.jl

Strings

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

Typstry

Typstry.Strings.ContextErrorType
ContextError <: Exception
 ContextError(::Type, ::Type, ::Symbol)

An Exception indicating that a context key returned a value of an incorrect type.

Examples

julia> ContextError(Mode, String, :mode)
-ContextError(Mode, String, :mode)
source
Typstry.Strings.ModeType
Mode

An Enumerated type used to specify that the current Typst syntactical context is code, markup, or math.

Examples

julia> Mode
 Enum Mode:
 code = 0
 markup = 1
-math = 2
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}
 TypstText(::Any)

A wrapper whose show_typst method uses print.

Examples

julia> TypstText(1)
 TypstText{Int64}(1)
 
 julia> TypstText("a")
-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) $"
@@ -33,34 +33,34 @@
 typst"(1 / 2)"
 
 julia> typst"\\(x)"
-typst"\\(x)"
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.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
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.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.iterateMethod
iterate(::TypstString)
 iterate(::TypstString, ::Integer)

See also TypstString.

Examples

julia> iterate(typst"a")
 ('a', 2)
 
 julia> iterate(typst"a", 1)
-('a', 2)
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.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, ::MIME"text/plain", ::ContextError)

Examples

julia> show(stdout, "text/plain", ContextError(Mode, String, :mode))
-ContextError(Mode, String, :mode)
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, ::MIME"text/plain", ::ContextError)

Examples

julia> show(stdout, "text/plain", ContextError(Mode, String, :mode))
+ContextError(Mode, String, :mode)
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
Base.showerrorMethod
showerror(::IO, ::ContextError)

Examples

julia> showerror(stdout, ContextError(Mode, String, :mode))
-ContextError: the `context` key `:mode` expected a value of type `Mode` but received `String`
source
+#"a"source
Base.showerrorMethod
showerror(::IO, ::ContextError)

Examples

julia> showerror(stdout, ContextError(Mode, String, :mode))
+ContextError: the `context` key `:mode` expected a value of type `Mode` but received `String`
source
diff --git a/development/tutorials/getting_started/index.html b/development/tutorials/getting_started/index.html index 9eeb467..08f886b 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]);