From 88dc6fac5d2d6f494e9c334261ecb40d3e156667 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 10 Sep 2019 23:16:13 -0700 Subject: Add --shift-heading-level-by option. Deprecate --base-heading-level. The new option does everything the old one does, but also allows negative shifts. It also promotes the document metadata (if not null) to a level-1 heading with a +1 shift, and demotes an initial level-1 heading to document metadata with a -1 shift. This supports converting documents that use an initial level-1 heading for the document title. Closes #5615. --- test/command/shift-heading-level-by.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/command/shift-heading-level-by.md (limited to 'test') diff --git a/test/command/shift-heading-level-by.md b/test/command/shift-heading-level-by.md new file mode 100644 index 000000000..1d8b8bdd0 --- /dev/null +++ b/test/command/shift-heading-level-by.md @@ -0,0 +1,33 @@ +``` +% pandoc --shift-heading-level-by 1 -t native -s +--- +title: My title +... + +# First heading + +## Second +^D +Pandoc (Meta {unMeta = fromList []}) +[Header 1 ("",[],[]) [Str "My",Space,Str "title"] +,Header 2 ("first-heading",[],[]) [Str "First",Space,Str "heading"] +,Header 3 ("second",[],[]) [Str "Second"]] +``` + +``` +% pandoc --shift-heading-level-by -1 -t native -s +--- +title: Old title +... + +# First heading + +## Second + +# Another top-level heading +^D +Pandoc (Meta {unMeta = fromList [("title",MetaInlines [Str "First",Space,Str "heading"])]}) +[Header 1 ("second",[],[]) [Str "Second"] +,Para [Str "Another",Space,Str "top-level",Space,Str "heading"]] +``` + -- cgit v1.2.3