fix(typst): ship template as partials so code blocks render (#12)
R-CMD-check / R CMD check (pull_request) Successful in 3m54s
R-CMD-check / R CMD check (pull_request) Successful in 3m54s
The single-file `template: civilytics-typst.typ` discarded Quarto's auto-generated `definitions` partial, so any Typst document containing a code block failed with `unknown variable: Skylighting`. Ship the template as Quarto template-partials instead, so Quarto keeps its definitions (Skylighting + token functions) and syntax-highlighted code blocks render while the Civilytics branding still applies: - split civilytics-typst.typ into typst-template.typ (the styling function) and typst-show.typ (the show/entry point, keyword-safe [ ] wrapping kept); remove the single-file template - use_civilytics_theme() now copies both partials and prints the template-partials usage - example report.qmd uses template-partials Verified: a report with an R code block renders with working syntax highlighting and full branding.
This commit is contained in:
+9
-7
@@ -135,12 +135,12 @@ use_civilytics_theme <- function(path = ".", force = FALSE) {
|
||||
.copy_pkg_file(file.path("quarto/latex", f), file.path("latex", f), path, force)
|
||||
}
|
||||
|
||||
# Typst
|
||||
.copy_pkg_file(
|
||||
"quarto/typst/civilytics-typst.typ",
|
||||
"typst/civilytics-typst.typ",
|
||||
path, force
|
||||
)
|
||||
# Typst — shipped as template-partials so Quarto keeps its Skylighting
|
||||
# definitions and syntax-highlighted code blocks render (see issue #12)
|
||||
typst_files <- c("typst-template.typ", "typst-show.typ")
|
||||
for (f in typst_files) {
|
||||
.copy_pkg_file(file.path("quarto/typst", f), file.path("typst", f), path, force)
|
||||
}
|
||||
|
||||
# Logos — for _brand.yml (expects assets/logo/)
|
||||
.copy_logos("assets/logo", path, force)
|
||||
@@ -158,7 +158,9 @@ use_civilytics_theme <- function(path = ".", force = FALSE) {
|
||||
message(" include-in-header: latex/civilytics.tex")
|
||||
message(" include-before-body: latex/civilytics-title.tex")
|
||||
message(" typst:")
|
||||
message(" template: typst/civilytics-typst.typ")
|
||||
message(" template-partials:")
|
||||
message(" - typst/typst-template.typ")
|
||||
message(" - typst/typst-show.typ")
|
||||
message("---")
|
||||
message("\nSee examples/report.qmd for a complete example.")
|
||||
invisible(NULL)
|
||||
|
||||
Reference in New Issue
Block a user