diff options
| author | John MacFarlane <[email protected]> | 2024-12-19 15:14:31 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-12-19 15:14:31 -0800 |
| commit | 7cff3590bc76e3f70cd6a30ac7bc97e860060809 (patch) | |
| tree | 039fc7ed5497d004f7805cc241d1475d7a400193 /src | |
| parent | 86dd2f7d666acb815397a43bbccc1764e5486a60 (diff) | |
Allow `--shift-heading-level-by=-1` to work in djot...
...in the same way it works for other formats (with the top-level
heading being promoted to metadata title). This needed special
treatment because of the way djot surrounds sections with Divs.
Closes #10459.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Transforms.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Transforms.hs b/src/Text/Pandoc/Transforms.hs index daa6e6d99..fdaad33e3 100644 --- a/src/Text/Pandoc/Transforms.hs +++ b/src/Text/Pandoc/Transforms.hs @@ -154,6 +154,11 @@ headerShift n (Pandoc meta (Header m _ ils : bs)) | n < 0 , m + n == 0 = headerShift n $ B.setTitle (B.fromList ils) $ Pandoc meta bs +-- for this case, see #10459: +headerShift n (Pandoc meta (Div attr@(_,"section":_,_) (Header m _ ils : as) : bs)) + | n < 0 + , m + n == 0 = headerShift n $ + B.setTitle (B.fromList ils) $ Pandoc meta (Div attr as : bs) headerShift n (Pandoc meta bs) = Pandoc meta (walk shift bs) where |
