We currently always indent blocks nested inside list items
so that they're aligned with the list item marker.
1. foo
bar
The Commonmark spec allows for, and some tools like pandoc prefer,
to use a more uniform indentation strategy
where everything is indented at least 4 spaces.
1. foo
bar
This change adds a new option, WithListIndentStyle
which allows users to customize this behavior.
There are two styles:
aligned: this is what we do right now
uniform: the new indentation strategy closer to pandoc
Note that "uniform" does not go all the way to meet pandoc's style.
Specifically, pandoc indents the initial paragraph as well:
- foo
bar
- baz
For now, we're only doing nested items:
- foo
bar
- baz
This is still valid, and it leaves more of the user's input intact.
If there's a strong preference to match pandoc's style,
we can switch to that in a future change.
Testing:
I've added a number of new test cases extracted from list
sections of other tests.
To verify no change in semantics,
I've also added a test that re-parses the new output
and compares it with the output of the old indentation style.
We currently always indent blocks nested inside list items so that they're aligned with the list item marker.
The Commonmark spec allows for, and some tools like pandoc prefer, to use a more uniform indentation strategy where everything is indented at least 4 spaces.
This change adds a new option, WithListIndentStyle which allows users to customize this behavior.
There are two styles:
Note that "uniform" does not go all the way to meet pandoc's style. Specifically, pandoc indents the initial paragraph as well:
For now, we're only doing nested items:
This is still valid, and it leaves more of the user's input intact. If there's a strong preference to match pandoc's style, we can switch to that in a future change.
Testing: I've added a number of new test cases extracted from list sections of other tests. To verify no change in semantics, I've also added a test that re-parses the new output and compares it with the output of the old indentation style.
Resolves #69