-
-
Notifications
You must be signed in to change notification settings - Fork 170
Add bullet list style options #229
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ fn fuzz_doesnt_crash(md: String) { | |
| width: 80, | ||
| unsafe_: true, | ||
| escape: false, | ||
| list_style: ::ListStyleType::Dash, | ||
| }, | ||
| }; | ||
|
|
||
|
|
@@ -62,12 +63,12 @@ fn compare_strs(output: &str, expected: &str, kind: &str) { | |
| } | ||
|
|
||
| #[track_caller] | ||
| fn commonmark(input: &str, expected: &str) { | ||
| fn commonmark(input: &str, expected: &str, opts: Option<&::ComrakOptions>) { | ||
| let arena = ::Arena::new(); | ||
| let mut options = ::ComrakOptions::default(); | ||
| options.render.width = 72; | ||
| let defaults = ::ComrakOptions::default(); | ||
| let options = opts.unwrap_or(&defaults); | ||
|
|
||
| let root = ::parse_document(&arena, input, &options); | ||
| let root = ::parse_document(&arena, input, options); | ||
| let mut output = vec![]; | ||
| cm::format_document(root, &options, &mut output).unwrap(); | ||
| compare_strs(&String::from_utf8(output).unwrap(), expected, "regular"); | ||
|
|
@@ -253,6 +254,31 @@ fn lists() { | |
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn markdown_list_bullets() { | ||
| let dash = concat!("- a\n"); | ||
| let plus = concat!("+ a\n"); | ||
| let star = concat!("* a\n"); | ||
| let mut dash_opts = ::ComrakOptions::default(); | ||
| dash_opts.render.list_style = ::ListStyleType::Dash; | ||
| let mut plus_opts = ::ComrakOptions::default(); | ||
| plus_opts.render.list_style = ::ListStyleType::Plus; | ||
| let mut star_opts = ::ComrakOptions::default(); | ||
| star_opts.render.list_style = ::ListStyleType::Star; | ||
|
|
||
| commonmark(dash, dash, Some(&dash_opts)); | ||
| commonmark(plus, dash, Some(&dash_opts)); | ||
| commonmark(star, dash, Some(&dash_opts)); | ||
|
|
||
| commonmark(dash, plus, Some(&plus_opts)); | ||
| commonmark(plus, plus, Some(&plus_opts)); | ||
| commonmark(star, plus, Some(&plus_opts)); | ||
|
|
||
| commonmark(dash, star, Some(&star_opts)); | ||
| commonmark(plus, star, Some(&star_opts)); | ||
| commonmark(star, star, Some(&star_opts)); | ||
| } | ||
|
|
||
| #[test] | ||
| fn thematic_breaks() { | ||
| html( | ||
|
|
@@ -263,6 +289,8 @@ fn thematic_breaks() { | |
|
|
||
| #[test] | ||
| fn width_breaks() { | ||
| let mut options = ::ComrakOptions::default(); | ||
| options.render.width = 72; | ||
| let input = concat!( | ||
| "this should break because it has breakable characters. break right here newline\n", | ||
| "\n", | ||
|
|
@@ -279,7 +307,7 @@ fn width_breaks() { | |
| "a-long-line-that-won't-break-because-there-is-no-character-it-can-break-on\n" | ||
| ); | ||
|
|
||
| commonmark(input, output); | ||
| commonmark(input, output, Some(&options)); | ||
| } | ||
|
|
||
| #[test] | ||
|
|
@@ -1272,6 +1300,7 @@ fn exercise_full_api<'a>() { | |
| width: 123456, | ||
| unsafe_: false, | ||
| escape: false, | ||
| list_style: ::ListStyleType::Dash, | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self for next release: this will need a correspondingly large bump because we're modifying the public API. (🤞 I remember.) |
||
| }, | ||
| }; | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.