mdBook
mdBook copied to clipboard
Add {{#shiftinclude}} command
Allows included code to be shifted left or right by a specified amount, or to be automatically left-shifted so that common leading whitespace is stripped.
Uses a new command name #shiftinclude to avoid changing the behaviour of any existing books.
There are few open issues[^1] that this might help with :
- #1430
- Covered by
{{#shiftinclude auto:file.rs}}here.
- Covered by
- #1564
- Covered by
{{#shiftinclude +4:myfn.rs}}here.
- Covered by
- #1601
- Covered by
{{#shiftinclude auto:file.rs}}here.
- Covered by
- #1626
- Helped by
{{#shiftinclude +4:../exercises/chapter6/test/no-peeking/Solutions.purs:eqNonEmpty}}(but would need to be left-aligned).
- Helped by
There are also a few open PRs that this might overtake/replace/combine-with:
- #1565
- #1718
- #1856
- This PR looks to have similar functionality to the
autovariant here (and is also careful not to affect existing behaviour).
- This PR looks to have similar functionality to the
[^1]: I confess that I implemented this without looking at the current open issues/pull requests.
Given that this looks unlikely to be included in the main mdBook code, I've pulled the functionality out into a separate mdbook-shiftinclude preprocessor.