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

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

edwar4rd
Copy link
Contributor

@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.

@kivikakk
Copy link
Owner

Thank you so much! Sorry about the slow response, have not had the capacity to process this yet!

@kivikakk kivikakk merged commit 5a8e449 into kivikakk:main Oct 22, 2024
20 checks passed
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.

2 participants