From faf0bd27c727c4cf0726dcd19814e9983921872e Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Fri, 14 Jun 2024 17:25:20 +0000 Subject: [PATCH] build based on 5ef5c71 --- development/.documenter-siteinfo.json | 2 +- development/getting_started/index.html | 2 +- development/index.html | 2 +- development/manual/commands/index.html | 38 +++++++++++----------- development/manual/extensions/index.html | 2 +- development/manual/internals/index.html | 32 +++++++++--------- development/manual/strings/index.html | 34 +++++++++---------- development/tutorials/interface/index.html | 2 +- 8 files changed, 57 insertions(+), 57 deletions(-) diff --git a/development/.documenter-siteinfo.json b/development/.documenter-siteinfo.json index 28cf36a..f32b4ce 100644 --- a/development/.documenter-siteinfo.json +++ b/development/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-14T16:36:26","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-14T17:25:17","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/development/getting_started/index.html b/development/getting_started/index.html index e8886a3..c66b927 100644 --- a/development/getting_started/index.html +++ b/development/getting_started/index.html @@ -11,4 +11,4 @@ typst"$ π approx 3.141592653589793 $"

Commands

Use render to easily generate a Typst source file and compile it into a document.

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

Compile source files by running a TypstCommand created using its constructor or @typst_cmd.

julia> TypstCommand(["help"])
 typst`help`
 
-julia> run(typst`compile input.typ output.pdf`);

Examples

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. Sequential documents correspond to package Extensions.

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

+julia> run(typst`compile input.typ output.pdf`);

Examples

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. Sequential documents correspond to package Extensions.

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

diff --git a/development/index.html b/development/index.html index 60cd4b3..e7e9c5d 100644 --- a/development/index.html +++ b/development/index.html @@ -25,4 +25,4 @@ typst`help` julia> addenv(typst`compile input.typ output.pdf`, "TYPST_FONT_PATHS" => julia_mono) -typst`compile input.typ output.pdf`

Features

Strings

Commands

Planned

Typst

LaTeX

+typst`compile input.typ output.pdf`

Features

Strings

Commands

Planned

Typst

LaTeX

diff --git a/development/manual/commands/index.html b/development/manual/commands/index.html index 7e1e127..fd1fd93 100644 --- a/development/manual/commands/index.html +++ b/development/manual/commands/index.html @@ -5,13 +5,13 @@ typst`help` julia> TypstCommand(help; ignorestatus = true) -typst`help`source
Typstry.TypstErrorType
TypstError <: Exception
-TypstError(::TypstCommand)

An Exception indicating a failure to run a TypstCommand.

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

An Exception indicating a failure to run a TypstCommand.

source
Typstry.@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.julia_monoConstant
julia_mono

An constant artifact containing the JuliaMono typeface.

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

source
Typstry.renderFunction
render(x;
+typst`compile input.typ output.typ`
source
Typstry.julia_monoConstant
julia_mono

An constant artifact containing the JuliaMono typeface.

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

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

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

This generates two files: the input is the Typst source text and the output is the compiled document. The document format is inferred by the file extension of output, which may 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> help = typst`help`
+context...)

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

This generates two files: the input is the Typst source text and the output is the compiled document. The document format is inferred by the file extension of output, which may 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> help = typst`help`
 typst`help`
 
 julia> help == help
 true
 
 julia> help == TypstCommand(help; ignorestatus = true)
-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

If the Typst compiler throws an error, it 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.

Compat

Requires at least Julia v0.8.

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.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([""]))`
source
+ 2source
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

If the Typst compiler throws an error, it 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.

Compat

Requires at least Julia v0.8.

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.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([""]))`
source
diff --git a/development/manual/extensions/index.html b/development/manual/extensions/index.html index e4ec685..b320bd0 100644 --- a/development/manual/extensions/index.html +++ b/development/manual/extensions/index.html @@ -1,4 +1,4 @@ Extensions · Typstry.jl

Extensions

Dates.jl

Typstry.show_typstMethod
show_typst(io, ::Union{
     Date, DateTime, Day, Hour, Minute, Second, Time, Week
-})

Print in Typst format for Dates.jl.

TypeSettingsParameters
Date:mode, :indent
DateTime:mode, :indent
Day:mode, :indent
Hour:mode, :indent
Minute:mode, :indent
Second:mode, :indent
Time:mode, :indent
Week:mode, :indent
source

LaTeXStrings.jl

Typstry.show_typstMethod
show_typst(io, ::LaTeXString)

Print in Typst format for LaTeXStrings.jl.

TypeSettingsParameters
LaTeXString:mode:block
source

Markdown.jl

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

Print in Typst format for Markdown.jl.

TypeSettingsParameters
Markdown.MD:mode:block
source
+})

Print in Typst format for Dates.jl.

TypeSettingsParameters
Date:mode, :indent
DateTime:mode, :indent
Day:mode, :indent
Hour:mode, :indent
Minute:mode, :indent
Second:mode, :indent
Time:mode, :indent
Week:mode, :indent
source

LaTeXStrings.jl

Typstry.show_typstMethod
show_typst(io, ::LaTeXString)

Print in Typst format for LaTeXStrings.jl.

TypeSettingsParameters
LaTeXString:mode:block
source

Markdown.jl

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

Print in Typst format for Markdown.jl.

TypeSettingsParameters
Markdown.MD:mode:block
source
diff --git a/development/manual/internals/index.html b/development/manual/internals/index.html index 3109f96..1242d18 100644 --- a/development/manual/internals/index.html +++ b/development/manual/internals/index.html @@ -1,44 +1,44 @@ -Internals · Typstry.jl

Internals

Strings

Typstry.preambleConstant
preamble

A constant used at the beginning of Typst source files generated by show(::IO, ::Union{MIME"application/pdf", MIME"image/png", MIME"image/svg+xml"}, ::TypstString).

Examples

julia> println(Typstry.preamble)
+Internals · Typstry.jl

Internals

Strings

Typstry.backticksFunction
backticks(io)

Return to io[:backticks]::Int.

Examples

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

Return io[:block]::Bool.

Examples

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

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

See also Mode and mode.

Examples

julia> Typstry.code_mode(IOContext(stdout, :mode => code))
+#set text(16pt, font: "JuliaMono")
source
Typstry.backticksFunction
backticks(io)

Return to io[:backticks]::Int.

Examples

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

Return io[:block]::Bool.

Examples

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

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

See also Mode and mode.

Examples

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

Return io[:depth]::Int.

Examples

julia> Typstry.depth(IOContext(stdout, :depth => 0))
-0
source
Typstry.encloseFunction
enclose(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 $
source
Typstry.formatFunction
format(::Union{MIME"application/pdf", MIME"image/png", MIME"image/svg+xml"})

Examples

julia> Typstry.format(MIME"application/pdf"())
+#
source
Typstry.depthFunction
depth(io)

Return io[:depth]::Int.

Examples

julia> Typstry.depth(IOContext(stdout, :depth => 0))
+0
source
Typstry.encloseFunction
enclose(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 $
source
Typstry.formatFunction
format(::Union{MIME"application/pdf", MIME"image/png", MIME"image/svg+xml"})

Examples

julia> Typstry.format(MIME"application/pdf"())
 "pdf"
 
 julia> Typstry.format(MIME"image/png"())
 "png"
 
 julia> Typstry.format(MIME"image/svg+xml"())
-"svg"
source
Typstry.indentFunction
indent(io)

Return " " ^ io[:tab_size]::Int.

See also TypstString.

Examples

julia> Typstry.indent(IOContext(stdout, :tab_size => 2))
-"  "
source
Typstry.join_withFunction
join_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
source
Typstry.math_padFunction
math_pad(io, x)

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

Examples

julia> Typstry.math_pad(IOContext(stdout, :mode => math))
+"svg"
source
Typstry.indentFunction
indent(io)

Return " " ^ io[:tab_size]::Int.

See also TypstString.

Examples

julia> Typstry.indent(IOContext(stdout, :tab_size => 2))
+"  "
source
Typstry.join_withFunction
join_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
source
Typstry.math_padFunction
math_pad(io, x)

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

Examples

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

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

Examples

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

Return io[:mode]::Mode.

See also Mode.

Examples

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

Return io[:parenthesize]::Bool.

Examples

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

Return io[:mode]::Mode.

See also Mode.

Examples

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

Return io[:parenthesize]::Bool.

Examples

julia> Typstry.parenthesize(IOContext(stdout, :parenthesize => true))
+true
source
Typstry.print_parametersFunction
print_parameters(io, f, keys, final)

Examples

julia> Typstry.print_parameters(
            IOContext(stdout, :depth => 0, :tab_size => 2, :delim => typst"\"(\""),
        "vec", [:delim, :gap], true)
 vec(
-  delim: "(",
source
Typstry.static_parseFunction
static_parse(args...; filename, kwargs...)

Call Meta.parse with the filename if it is supported in the current Julia version (at least v1.10).

source

Commands

Typstry.typst_compilerConstant
typst_compiler

A constant Cmd that is the Typst compiler given by Typst_jll.jl with no additional parameters.

source

Extensions

Dates

+ delim: "(",
source
Typstry.static_parseFunction
static_parse(args...; filename, kwargs...)

Call Meta.parse with the filename if it is supported in the current Julia version (at least v1.10).

source

Commands

Typstry.typst_compilerConstant
typst_compiler

A constant Cmd that is the Typst compiler given by Typst_jll.jl with no additional parameters.

source

Extensions

Dates

diff --git a/development/manual/strings/index.html b/development/manual/strings/index.html index f7dccff..81bfcb3 100644 --- a/development/manual/strings/index.html +++ b/development/manual/strings/index.html @@ -3,22 +3,22 @@ Enum Mode: code = 0 markup = 1 -math = 2source
Typstry.TypstType
Typst{T}
+math = 2
source
Typstry.TypstType
Typst{T}
 Typst(::T)

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

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

Convert the value to 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 unspecified, which may result in unexpected behavior.

Examples

julia> TypstString(1)
 typst"#1"
 
 julia> TypstString(1 + 2im; mode = math)
-typst"(1 + 2i)"
source
Typstry.TypstTextType
TypstText{T}
+typst"(1 + 2i)"
source
Typstry.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.@typst_strMacro
@typst_str(s)
+TypstText{String}("a")
source
Typstry.@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.

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,34 +31,34 @@
 typst"(1 / 2)"
 
 julia> typst"\\(x)"
-typst"\\(x)"
source
Typstry.codeConstant
code

A Typst syntactical Mode prefixed by the number sign.

Examples

julia> code
-code::Mode = 0
source
Typstry.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.mathConstant
math

A Typst syntactical Mode enclosed within dollar signs.

julia> math
-math::Mode = 2
source
Typstry.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}.

KeyDefaultTypeDescription
:backticks3IntThe number of backticks to enclose raw text markup, which may be increased to insert 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.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. Settings are used in Julia to format the TypstString. Parameters are passed to a function in the Typst source file and must be a TypstString with the same name as in Typst, except that dashes are replaced with underscores. Some settings, such as block, correspond with a parameter but may be used in Julia and have a different type.

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
Docs.HTML:block, :indent, :mode`
Docs.Text:mode
AbstractArray:block, :depth, :mode, :tab_size:delim,:gap`
AbstractChar:mode
AbstractFloat:mode
AbstractMatrix:block, :depth, :mode, :tab_size:augment, :columngap,:delim,:gap,:rowgap`
AbstractString:mode
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
String:mode
Tuple:block, :depth, :mode, :tab_size:delim, :gap
Typst
TypstString
TypstText:mode
Unsigned:mode
VersionNumber:mode

```

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.codeConstant
code

A Typst syntactical Mode prefixed by the number sign.

Examples

julia> code
+code::Mode = 0
source
Typstry.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.mathConstant
math

A Typst syntactical Mode enclosed within dollar signs.

julia> math
+math::Mode = 2
source
Typstry.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}.

KeyDefaultTypeDescription
:backticks3IntThe number of backticks to enclose raw text markup, which may be increased to insert 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.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. Settings are used in Julia to format the TypstString. Parameters are passed to a function in the Typst source file and must be a TypstString with the same name as in Typst, except that dashes are replaced with underscores. Some settings, such as block, correspond with a parameter but may be used in Julia and have a different type.

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
Docs.HTML:block, :indent, :mode`
Docs.Text:mode
AbstractArray:block, :depth, :mode, :tab_size:delim,:gap`
AbstractChar:mode
AbstractFloat:mode
AbstractMatrix:block, :depth, :mode, :tab_size:augment, :columngap,:delim,:gap,:rowgap`
AbstractString:mode
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
String:mode
Tuple:block, :depth, :mode, :tab_size:delim, :gap
Typst
TypstString
TypstText:mode
Unsigned:mode
VersionNumber:mode

```

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 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 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 the Typst format.

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

See also 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 the Typst format.

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

See also 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.showMethod
show(::IO, ::Union{
+#"a"
source
Base.showMethod
show(::IO, ::Union{
     MIME"application/pdf", MIME"image/png", MIME"image/svg+xml"
-}, ::TypstString)

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.

Note

Environments, such as Pluto.jl notebooks, may use these methods to display a TypstString.

source
+}, ::TypstString)

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.

Note

Environments, such as Pluto.jl notebooks, may use these methods to display a TypstString.

source diff --git a/development/tutorials/interface/index.html b/development/tutorials/interface/index.html index 38c08db..206c1a5 100644 --- a/development/tutorials/interface/index.html +++ b/development/tutorials/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)