Skip to content

Commit

Permalink
Export preamble
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobjpeters committed Jul 13, 2024
1 parent 5e79e69 commit 26a0047
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

### Commands

- `preamble` is now exported
- `render` now supports a custom `preamble`

## Bug Fixes
Expand Down
1 change: 1 addition & 0 deletions docs/source/manual/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ TypstCommand
TypstError
@typst_cmd
julia_mono
preamble
render
```

Expand Down
1 change: 0 additions & 1 deletion docs/source/manual/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Typstry.Strings.dates
## Commands

```@docs
Typstry.Commands.preamble
Typstry.Commands.typst_compiler
Typstry.Commands.apply
```
38 changes: 19 additions & 19 deletions src/Commands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/Typstry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 26a0047

Please sign in to comment.