File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ import { kTemplatePartials } from "../../command/render/template.ts";
5353import { copyTo } from "../../core/copy.ts" ;
5454import { kCodeAnnotations } from "../html/format-html-shared.ts" ;
5555import { safeModeFromFile } from "../../deno_ral/fs.ts" ;
56+ import { hasLevelOneHeadings as hasL1Headings } from "../../core/lib/markdown-analysis/level-one-headings.ts" ;
5657
5758export function pdfFormat ( ) : Format {
5859 return mergeConfigs (
@@ -138,7 +139,7 @@ function createPdfFormat(
138139 metadata : {
139140 [ "block-headings" ] : true ,
140141 } ,
141- formatExtras : (
142+ formatExtras : async (
142143 _input : string ,
143144 markdown : string ,
144145 flags : PandocFlags ,
@@ -254,7 +255,7 @@ function createPdfFormat(
254255 } ;
255256
256257 // Don't shift the headings if we see any H1s (we can't shift up any longer)
257- const hasLevelOneHeadings = ! ! markdown . match ( / \n ^ # \s . * $ / gm ) ;
258+ const hasLevelOneHeadings = await hasL1Headings ( markdown ) ;
258259
259260 // pdfs with no other heading level oriented options get their heading level shifted by -1
260261 if (
You can’t perform that action at this time.
0 commit comments