Skip first X lines, or skip last X lines, for table headers/footers
Krellan opened this issue · 4 comments
Thought of a feature request.
Would be nice to have an option to skip the first X lines, to preserve an unsorted header, such as a Markdown table in which you need to preserve the first 2 lines and keep them unsorted.
For symmetry, also have an option to skip the last X lines, similarly.
Any thoughts on this? Thanks!
Do you have an example of what you're describing that I could take a look at?
Glad you asked. Here's Markdown. I'm not sure if GitHub lets you view source, but I'm hoping it does.
Name | Value |
---|---|
Alpha | Foo |
Bravo | Bar |
Charlie | Baz |
Delta | Qux |
The objective is to avoid wrongly sorting the header row and the divdier row (between the header and the content), while making sure the content itself (all following lines) remains sorted.
Ah okay, and putting the comment in the correct place without the skip-first directive breaks markdown formatting:
<!-- Example to want to avoid sorting the first two lines -->
Name | Value
---- | ----
<!-- keep-sorted start -->
Alpha|Foo
Bravo|Bar
Charlie | Baz
Delta|Qux
<!-- keep-sorted end -->
Name | Value |
---|
Alpha|Foo
Bravo|Bar
Charlie | Baz
Delta|Qux
keep-sorted doesn't actually require that its start directive be on its own line, but that also breaks markdown formatting:
<!-- Example to want to avoid sorting the first two lines -->
Name | Value
---- | ---- <!-- keep-sorted start -->
Alpha|Foo
Bravo|Bar
Charlie | Baz
Delta|Qux
<!-- keep-sorted end -->
Name | Value
---- | ----
Alpha|Foo
Bravo|Bar
Charlie | Baz
Delta|Qux
This seems like reasonable functionality to add to keep-sorted
Yep, you got it! That's exactly the use case. Thanks for taking a look at it.