Skip to content

Switch to term-list-like impl for list - #4541

Closed
Enter-tainer wants to merge 1 commit into
typst:mainfrom
Enter-tainer:mgt/list
Closed

Enter-tainer wants to merge 1 commit into
typst:mainfrom
Enter-tainer:mgt/list

Conversation

@Enter-tainer

Copy link
Copy Markdown
Contributor

fix #4126 fix #1204

item.body.clone().styled(ListElem::set_depth(Depth(1))),
locator.next(&item.body.span()),
));
let pad = body_indent + indent; // TODO: plus marker width

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i need to measure the width of marker here. But I haven't figure out how to do it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks strange, but also happens in term list and normal text. I'm not sure if this is intented or not

@Enter-tainer Enter-tainer Jul 11, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason markers don't change depending on depth. I haven't figure out why. Help 🆘

@laurmaedje laurmaedje changed the title feat: switch to term-list-like impl for list Switch to term-list-like impl for list Jul 14, 2024
@laurmaedje laurmaedje added the waiting-on-review This PR is waiting to be reviewed. label Jul 14, 2024
@laurmaedje

laurmaedje commented Aug 27, 2024 •

Copy link
Copy Markdown
Member

I made a more comprehensive attempt at https://github.com/typst/typst/tree/better-lists, which updates all list kinds to behave more like in LaTeX.

The changes are similar to these ones, but make some different implementation choices, adjust the settable properties to the new model, and include the necessary measurement code.

Code
#set list(marker: [--])
#lorem(8)

- #lorem(5)
- Lorem

+ A
+ B
+ C

/ Hello: #lorem(8)
/ World: Lorem

New lists

As the tests indicate, it still has things we need to think through though, particularly with block-level content directly after the marker, which will produce a parbreak:

- #rect()

Bad rect

@Enter-tainer

Copy link
Copy Markdown
Contributor Author

hi, wondering if there is any updates on better lists branch.

@laurmaedje

Copy link
Copy Markdown
Member

Unfortunately no. It's pretty difficult to express lists with existing layout constructs, so that inline & block content works as expected, baseline alignment is respected, etc. We might need to write a custom list layouter.

@flaribbit

Copy link
Copy Markdown

Just wanted to follow up and ask if there are any new updates on the better-lists.

In the meantime, the community has created a great package, itemize, which serves as an effective temporary solution. However, this shouldn't be a long-term fix.

Looking forward to future progress on this. Thanks for all your hard work!

@laurmaedje laurmaedje removed the waiting-on-review This PR is waiting to be reviewed. label Dec 4, 2025
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.

List indentation should not depend on marker width List and enum markers are not aligned with the baseline of the item's contents

3 participants