Skip to content

Commit

Permalink
update lib.typ
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Oct 29, 2023
1 parent 4ce953f commit a5ec5d7
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions contrib/typst/variables/lib.typ
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
//! This is a stub package for typst.ts's dyn-svg controlling the layout
//! Here is a good example of dynamic layout template: <https://github.com/Myriad-Dreamin/typst-book/blob/308e0aacc2578e9a0c424d20332c6711d1df8d1c/contrib/typst/gh-pages.typ>

// It is in default A4 paper size
#let page-width = 595.28pt

// default target is "pdf"
/// default target is "pdf", typst.ts will set it to "web" when rendering to a
/// dynamic layout
/// Example:
/// ```typc
/// #let is-web-target() = target.starts-with("web")
/// #let is-pdf-target() = target.starts-with("pdf")
/// ```
#let target = "pdf"

/// It is in default A4 paper size
/// example:
/// ```typc
/// set page(
/// width: page-width,
/// height: auto, // Also, for a website, we don't need pagination.
/// ) if is-web-target;
/// ```
#let page-width = 595.28pt

0 comments on commit a5ec5d7

Please sign in to comment.