Commit Graph
32 Commits
Author SHA1 Message Date
Ian Max Andolina c198e7e3cc Typst template: rename horizontalrule to horizontalRule (#11784)
The polyfill calls a camelCase `horizontalRule` yet the function is not cameCase.
2026-07-30 12:30:04 +02:00
John MacFarlane d982f9f5ec Typst template: polyfill divider for typst < 0.15. 2026-07-09 01:28:43 +02:00
John MacFarlane d2f33e5b53 Typst reader/writer: use divider() for horizontal rule.
Remove old `horizontalRule` definition from default template.

Modify tests to use non-deprecated symbols.

Closes #11540.
2026-07-09 01:12:18 +02:00
John MacFarlane 1d6f33b897 Typst: further tight term list improvements.
Modified default template to remove custom show rule for
terms. Instead, we use a set rule to set hanging-indent.

For tight list items consisting of just one Plain block,
we no longer create a `#block` for the definition; this allows
it to remain on the same line as the term.
2026-07-08 11:18:31 +02:00
Albert Krewinkel c568a0e665 Typst template: allow multiword keywords (#11730)
Typst expects single words as keywords, so keywords consisting of
multiple words must be quoted (and should not be wrapped).
2026-06-23 19:06:58 +02:00
Mickaël Canouil 65f0b491c9 Typst template: improve accessibility of definition lists (#11436).
The show rule we used for definition lists created problems when
typst was run with `--pdf-standard=ua-1`.  This patch fixes things,
and also prevents definition list items from breaking across pages.
2026-02-03 21:58:28 +01:00
har7an bbedaadc4d Typst template: Fix keywords usage. (#11317)
Previously the template turned any `keywords` defined in Pandoc metadata
into empty objects due to a misnomer in a loop variable. This in turn
was rejected by the Typst compiler as invalid syntax, making document
generation with keywords impossible.
2025-12-02 09:56:10 +01:00
Mickaël Canouil ba64240f2c Typst template: fix syntax for bibliography inclusion (#11233)
Previously the syntax was wrong when multiple bibliography files were
specified.  Typst expects an array.
2025-10-23 11:31:57 +02:00
John MacFarlane 3ffd47af68 Typst writer: Fix syntax highlighting.
See #11171.  Previously the native typst highlighting was
always used, regardless of the setting of `--syntax-highlighting`.
With this change, `--syntax-highlighting=none` and
`--syntax-highlighting=<style name>` (with skylighting) will work.

Completes #10525.
2025-09-28 15:36:21 +02:00
Christopher T. Kenny 6070ad29cd Add features to typst base template (take 2).
New template variables supported: `thanks`, `abstract-title`, `linestretch`, `mathfont`, 
`codefont`, `linkcolor`, `filecolor`, `citecolor`.

Closes #9956, #11076.

(This is a new version of f000fa168b which
was reverted.)
2025-09-02 09:25:39 +02:00
John MacFarlane 4c69f288d9 Revert "Add features to typst base template."
This reverts commit f000fa168b.
2025-08-24 09:47:44 +02:00
Albert Krewinkel 6dae03f719 Typst writer: add native Typst support for nocite.
The `nocite` metadata field can now be used to supply additional
citations that don't appear in the text, just as with citeproc and
LaTeX's bibtex and natbib.

Closes: #10680
2025-07-30 11:59:41 +02:00
Christopher Kenny f000fa168b Add features to typst base template.
This implements the changes suggested in #9956, with the exception of
the filecolor/urlcolor one. These would require adding some regex to
guess the link types. This is theoretically possible to do, but it
wasn't clear to me that this is a good thing to put in a default
template. Happy to adjust if you have thoughts on this.

Closes #9956.

Some things to note:

I'm converting colors by passing them as content, as I was seeing pandoc
escape # if that was included.

I set the default fonts for math and code ("raw") to fonts that are
bundled with Typst. These need not be those fonts if there are more
familiar pandoc preferences.
2025-07-24 10:45:28 -07:00
John MacFarlane be734d2543 Remove definitions.typst partial.
Remove unnecessary definition of `endnote`.
Incorporate the one remaining definition into `default.typst`.
2024-11-11 10:23:18 -08:00
John MacFarlane d5d2821a4d Typst writer: make template sensitive to a page-numbering variable.
This can be set to an empty string (or, in metadata, to false) for
no page numbers.

Addresses #10370.
2024-11-09 11:38:08 -08:00
John MacFarlane bdb1172385 Typst writer: make smart extension work.
If `smart` is not enabled, a command in the default template will
disable smartquote substitutions.

When `smart` is enabled, render curly apostrophes as straight
and escape straight apostrophes.

When `smart` is disabled, render curly apostrophes as curly
and don't escape straight apostrophes.

And similarly for quotes, em and en dashes.

This should give more idiomatic typst output, with fewer unnecessary
escapes.

Closes #10271.
2024-10-08 21:58:25 -07:00
John MacFarlane a27dad6f68 Add options to change table/figure caption positions.
+ Add command line options `--table-caption-position` and
  `--figure-caption-position`. These allow the user to specify whether
  to put captions above or below tables and figures, respectively.
  The following output formats are supported: HTML (and related such
  as EPUB), LaTeX (and Beamer), Docx, ODT/OpenDocument, Typst.

+ Text.Pandoc.Options: add `CaptionPosition` and new
  `WriterOptions` fields `writerFigureCaptionPosition` and
  `writerTableCaptionPosition` [API change].

+ Text.Pandoc.Opt: add `Opt` fields `optFigureCaptionPosition` and
  `optTableCaptionPosition` [API change].

+ Docx writer: make table/figure rendering sensitive to caption
  position settings.

+ OpenDocument writer: make table/figure rendering sensitive to
  caption position settings.

+ Typst writer/template: implement figure caption positions by
  triggering a show rule in the default template, which determines caption
  positions for figures and tables globally.

+ LaTeX writer: make table/figure rendering sensitive to caption
  position settings. Closes #5116.

+ HTML writer/template: make `<figcaption>` placement sensitive to caption
  position settings.  For tables, `<caption>` must be the first element,
  and positioning is determined by CSS, for here we set a variable
  which the default template is sensitive to.
2024-09-08 08:29:09 -07:00
Gordon Woodhull 2575490c17 typst template: move header-includes before show doc (#10070)
Closes #9996.
2024-08-08 09:18:21 -07:00
John MacFarlane 0e92d9483c Typst template: use content rather than string...
...for title, author, date, email.

Fixes #9823 (escaped `\@` in rendered email).
Allows formatting in title, author, date, and email fields.
Since the PDF metadata requires a string, and typst only
converts the title to a string (not the authors), we use
a small function content-to-string to do this conversion.
Background: https://github.com/typst/typst/issues/2196
2024-05-30 12:00:48 -06:00
Mickaël Canouil fef5f2d94c Add subtitle to Typst template (#9747) 2024-05-12 09:39:27 -07:00
John MacFarlane 604f541b0f Typst writer: support Typst 0.11 table features. (#9593)
* Typst writer: support Typst 0.11 table features.

- colspans
- rowspans
- cell alignment overrides
- relative column widths
- header and footer
- multiple table bodies with intermediate headers

Row heads are not yet supported.

The default typst template has been modified so that tables
don't have lines by default. As is standard with pandoc, we only
add a line under a header or over a footer. However, a different
default stroke pattern can easily be added in a template.

Closes #9588.
2024-03-20 14:25:08 -07:00
John MacFarlane 2514ad2531 Typst template: set table inset globally. 2024-03-16 10:26:14 -07:00
John MacFarlane ea9317c73d Typst template fixes. 2023-12-11 10:18:37 -08:00
John MacFarlane 5bd301ef45 Typst writer/template: support --toc-depth as in other writers.
Closes #9242.
2023-12-07 14:39:21 -08:00
Ian Max Andolina e562d23bc7 Update default.typst to support csl (#9186)
Typst now supports CSL for its native citation engine, so pandoc
should use a specified `csl` style in the template, falling back to
`bibliographystyle` if `csl` is not specified.

https://typst.app/docs/reference/meta/bibliography/
2023-11-14 19:46:18 -08:00
John MacFarlane 1b52baaf37 Typst writer: consolidate bibliography files...
into one `#bibliography` command. (Separate bibliographies are
not possible.)  Closes #8937.
2023-07-03 08:24:01 -07:00
John MacFarlane 2c8de4c129 Typst writer: use #footnote for notes.
Closes #8893.
2023-06-05 16:07:36 -07:00
John MacFarlane e89a3edf24 Typst writer: omit bibliography if citations not enabled.
With this change, the typst writer will omit the `#bibliography`
command when `citations` is not enabled.  (If you want to use
pandoc's own `--citeproc`, you should combine it with
`-t typst-citations` to disable native typst citations.

Closes #8763.
2023-04-07 08:24:47 -07:00
John MacFarlane fd85560b84 Typst: Use customized term instead of custom macro for def lists. 2023-03-27 10:47:15 -07:00
John MacFarlane 4780b4760d More Typst writer improvements.
+ Update manual with variables for Typst.
+ Split `lang` metadata into separate `lang` and `region` for Typst.
+ Fix label positioning in Divs.
+ Fix text customizations (lang, region, font, size) so they actually
  work.
+ Update tests and man page.
2023-03-26 21:32:31 -07:00
John MacFarlane cd6b3bde62 Typst writer improvements.
+ Fix non-decimal enumerated lists.
+ Fix endnotes ending with code blocks.
+ Improve default template to use a typst template.
+ Factor out definitions and typst template into partials.
+ Properly escape backslash and quote inside double quotes.
+ Update tests.
2023-03-26 19:02:05 -07:00
John MacFarlane 9edf965712 Add typst writer.
See #8713.
2023-03-25 22:05:52 -07:00