typst / typst/typst

Highlight: support same background settings as e.g. box

Open
#2,934 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Currently, highlight only support extend to modify the shape of the background, which extends in all directions. It would be nice if it had the same options as box:

Use Case

Box is a rectangle and can't break over lines. Thus, highlighting long code like here on GitHub is not possible:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim aeque doleamus animo

This can be done with the highlight function, but it lacks the styling possibilities to make it really useful.

Another option would be to add this general styling of the background to the text function.

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 comparing the highlight and box reference pages, especially the listed stroke, radius, inset, and outset parameters, and trace how highlight handles backgrounds across line breaks. Define how each option should behave for multi-line highlights and whether the API belongs on highlight or text; done means the chosen behavior is documented and works for the stated long-text use case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.