git.iko.soy/typeable/pandoc
on master help sign in
Roll back part of of `--shift-heading-level-by` change.
992f77cJohn MacFarlane
MANUAL.txt+7−6
@@ -493,14 +493,15 @@ header when requesting a document from a URL:
493 headings become level 1 headings, and level 3 headings
493 headings become level 1 headings, and level 3 headings
494 become level 2 headings. Headings cannot have a level
494 become level 2 headings. Headings cannot have a level
495 less than 1, so a heading that would be shifted below level 1
495 less than 1, so a heading that would be shifted below level 1
496− becomes a regular paragraph. Exception: with a shift of -1,
496+ becomes a regular paragraph. Exception: with a shift of -N,
497− a level-1 heading at the beginning of the document
497+ a level-N heading at the beginning of the document
498− replaces the metadata title. Conversely, with a shift
498+ replaces the metadata title. `--shift-heading-level-by=-1`
499− of +1, a nonempty metadata title becomes a level-1 heading at
500− the beginning of the document. `--shift-heading-level-by=-1`
501 is a good choice when converting HTML or Markdown documents that
499 is a good choice when converting HTML or Markdown documents that
502 use an initial level-1 heading for the document title and
500 use an initial level-1 heading for the document title and
503− level-2+ headings for sections.
501+ level-2+ headings for sections. `--shift-heading-level-by=1`
502+ may be a good choice for converting Markdown documents that
503+ use level-1 headings for sections to HTML, since pandoc uses
504+ a level-1 heading to render the document title.
504
505
505`--base-header-level=`*NUMBER*
506`--base-header-level=`*NUMBER*
506
507
src/Text/Pandoc/Shared.hs−6
@@ -641,12 +641,6 @@ headerShift n (Pandoc meta (Header m _ ils : bs))
641 | n < 0
641 | n < 0
642 , m + n == 0 = headerShift n $
642 , m + n == 0 = headerShift n $
643 B.setTitle (B.fromList ils) $ Pandoc meta bs
643 B.setTitle (B.fromList ils) $ Pandoc meta bs
644−headerShift n (Pandoc meta bs)
645− | n > 0
646− , not (null (docTitle meta))
647− = Pandoc meta' (Header n nullAttr (docTitle meta) : bs')
648− where
649− Pandoc meta' bs' = headerShift n $ B.deleteMeta "title" $ Pandoc meta bs
650headerShift n (Pandoc meta bs) = Pandoc meta (walk shift bs)
644headerShift n (Pandoc meta bs) = Pandoc meta (walk shift bs)
651 where
645 where
652 shift :: Block -> Block
646 shift :: Block -> Block
test/command/shift-heading-level-by.md+2−3
@@ -8,9 +8,8 @@ title: My title
8
8
9## Second
9## Second
10^D
10^D
11−Pandoc (Meta {unMeta = fromList []})
11+Pandoc (Meta {unMeta = fromList [("title",MetaInlines [Str "My",Space,Str "title"])]})
12−[Header 1 ("",[],[]) [Str "My",Space,Str "title"]
13−,Header 2 ("first-heading",[],[]) [Str "First",Space,Str "heading"]
12+[Header 2 ("first-heading",[],[]) [Str "First",Space,Str "heading"]
14,Header 3 ("second",[],[]) [Str "Second"]]
13,Header 3 ("second",[],[]) [Str "Second"]]
15```
14```
16
15