From a5ec5d7f40802aa2d2e06d9fd540baae1d8ba7d9 Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Sun, 29 Oct 2023 11:27:33 +0800 Subject: [PATCH] update lib.typ --- contrib/typst/variables/lib.typ | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/contrib/typst/variables/lib.typ b/contrib/typst/variables/lib.typ index 2f1aa92..fb73339 100644 --- a/contrib/typst/variables/lib.typ +++ b/contrib/typst/variables/lib.typ @@ -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: -// 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