Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: fit-to-width #96

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

ntjess
Copy link
Contributor

@ntjess ntjess commented Sep 2, 2023

Use case: I want my slide header to always take up one line, regardless of how long that line is. This function solves the problem by allowing text to shrink to it's requested width

show heading.where(level: 2): it => {
  layout(layout-size => {
    fit-to-width(width: layout-size.width, it)
  })
}

#set page(height: auto)
#slide[
  == Lorem
]

#slide[
  == #lorem(10)
]

#slide[
  == #lorem(15)
]

Results in:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant