From 26a0047eb2e967c5c599f19d562982be32bb99cc Mon Sep 17 00:00:00 2001 From: Jakob Peters Date: Sat, 13 Jul 2024 03:38:55 +0200 Subject: [PATCH] Export `preamble` --- NEWS.md | 1 + docs/source/manual/commands.md | 1 + docs/source/manual/internals.md | 1 - src/Commands.jl | 38 ++++++++++++++++----------------- src/Typstry.jl | 4 ++-- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/NEWS.md b/NEWS.md index 068b6e5..c4bbeda 100644 --- a/NEWS.md +++ b/NEWS.md @@ -21,6 +21,7 @@ ### Commands +- `preamble` is now exported - `render` now supports a custom `preamble` ## Bug Fixes diff --git a/docs/source/manual/commands.md b/docs/source/manual/commands.md index e61812b..2b45795 100644 --- a/docs/source/manual/commands.md +++ b/docs/source/manual/commands.md @@ -8,6 +8,7 @@ TypstCommand TypstError @typst_cmd julia_mono +preamble render ``` diff --git a/docs/source/manual/internals.md b/docs/source/manual/internals.md index d80ebc0..d35fe7c 100644 --- a/docs/source/manual/internals.md +++ b/docs/source/manual/internals.md @@ -45,7 +45,6 @@ Typstry.Strings.dates ## Commands ```@docs -Typstry.Commands.preamble Typstry.Commands.typst_compiler Typstry.Commands.apply ``` diff --git a/src/Commands.jl b/src/Commands.jl index 2a7ea34..10af3d5 100644 --- a/src/Commands.jl +++ b/src/Commands.jl @@ -13,25 +13,6 @@ using Typst_jll: typst # Internals -""" - preamble - -A constant used at the beginning of Typst source files generated by -[`show(::IO,\u00A0::Union{MIME"application/pdf",\u00A0MIME"image/png",\u00A0MIME"image/svg+xml"},\u00A0::TypstString)`](@ref). - -# Examples - -```jldoctest -julia> println(Typstry.Commands.preamble) -#set page(margin: 1em, height: auto, width: auto, fill: white) -#set text(16pt, font: "JuliaMono") -``` -""" -const preamble = typst""" -#set page(margin: 1em, height: auto, width: auto, fill: white) -#set text(16pt, font: "JuliaMono") -""" - """ typst_compiler @@ -128,6 +109,25 @@ Use with a [`TypstCommand`](@ref) and one of [`addenv`](@ref), """ const julia_mono = artifact"JuliaMono" +""" + preamble + +A constant used at the beginning of Typst source files generated by +[`show(::IO,\u00A0::Union{MIME"application/pdf",\u00A0MIME"image/png",\u00A0MIME"image/svg+xml"},\u00A0::TypstString)`](@ref). + +# Examples + +```jldoctest +julia> println(Typstry.Commands.preamble) +#set page(margin: 1em, height: auto, width: auto, fill: white) +#set text(16pt, font: "JuliaMono") +``` +""" +const preamble = typst""" +#set page(margin: 1em, height: auto, width: auto, fill: white) +#set text(16pt, font: "JuliaMono") +""" + """ render(x; input = "input.typ", diff --git a/src/Typstry.jl b/src/Typstry.jl index c4217c5..7dc50ab 100644 --- a/src/Typstry.jl +++ b/src/Typstry.jl @@ -8,8 +8,8 @@ using .Strings: Mode, Typst, TypstString, TypstText, @typst_str, code, markup, m export Mode, Typst, TypstString, TypstText, @typst_str, code, markup, math, context, show_typst include("Commands.jl") -using .Commands: TypstCommand, TypstError, @typst_cmd, julia_mono, render -export TypstCommand, TypstError, @typst_cmd, julia_mono, render +using .Commands: TypstCommand, TypstError, @typst_cmd, julia_mono, preamble, render +export TypstCommand, TypstError, @typst_cmd, julia_mono, preamble, render """ compile_workload(examples)