typst / typst/typst

Settable <header> and <footer> with bundled HTML export

Open
#8,569 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bundle feature request html
Dominant language
Rust
Stars
56.1k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
22

Description

Description

Would it be possible to use Typst' native syntax to specify a custom header and footer to be applied to every HTML page exported with the bundled feature?

Use Case

Imagine wanting to apply a static header and footer to each HTML page exported with the bundle export feature. One way of doing this using Typst' current feature set is by wrapping #document within a custom #my-document function:

#let my-document(title, body, ..options) = {
    document(title, ..options)[
        #html.header[
            This is an header.
        ]
        #body
        #html.footer[
            This is a footer.
        ]
    ]
}

However, if every HTML page to be served by the project resides in its own file, this requires importing #my-document every time at the top of the file using it.

How about using page.header and page.footer instead?

#set page(
    header: [This is an header],
    footer: [This is a footer.],
)

In this way, this set rule could be applied within a custom template, and subfiles or other HTML pages in general would not need to worry about using #my-document instead of #document.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the bundled HTML export and the existing #html.header and #html.footer constructs described in the issue, then compare them with the proposed page.header and page.footer set rule. Done means a custom template can define a static header and footer once, and every bundled HTML page receives them without importing a wrapper document function.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.