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

Add option for specifying a minimum width of ordered lists #465

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

edwar4rd
Copy link

@edwar4rd edwar4rd commented Sep 6, 2024

See #464 .
I added ol_width in rendering options to specify the reserved width of ordered list markers.
For example, having ol_width = 5 give you 1. something and 123. something and 1234. something.
A single whitespace is always added, so ol_width <= 3 have no effect.
The previous behavior is equivalent to ol_width = 4.

Test tests::commonmark::commonmark_relist is adjusted with the changes.
During testing, self.prefix.len() - marker_width can sometimes cause a overflow.
I'm not too sure what do self.prefix mean, but

let new_len = if self.prefix.len() > marker_width {
    self.prefix.len() - marker_width
} else {
    0
};

seemed to work fine.

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.

1 participant