@@ -3,6 +3,8 @@ import LineBreaker from "linebreak";
33import type { Writeable } from "./utils" ;
44import type { BlockNode , VoidNode , TextNode } from "./mdast-util-to-pdf" ;
55
6+ const max = Math . max ;
7+
68export type Alignment = "left" | "right" | "center" ;
79
810export type RegisteredFont = {
@@ -74,7 +76,7 @@ export const layoutBlock = (
7476 const inlines = children . filter (
7577 ( c ) => c . type === "text" || c . type === "void" ,
7678 ) ;
77- let y = Math . max ( startY , contentTop ) ;
79+ let y = max ( startY , contentTop ) ;
7880 if ( children . length !== inlines . length ) {
7981 let afterPagebreak = false ;
8082 for ( let i = 0 ; i < children . length ; i ++ ) {
@@ -141,10 +143,10 @@ export const layoutBlock = (
141143 ) ;
142144 cellBoxes . push ( boxes ) ;
143145 const maxCellBottom = boxes . reduce (
144- ( acc , b ) => Math . max ( acc , b . y + b . height ) ,
146+ ( acc , b ) => max ( acc , b . y + b . height ) ,
145147 tableY ,
146148 ) ;
147- cellHeight = Math . max ( cellHeight , maxCellBottom - tableY ) ;
149+ cellHeight = max ( cellHeight , maxCellBottom - tableY ) ;
148150 }
149151 for ( const boxes of cellBoxes ) {
150152 childBoxes . push ( ...boxes ) ;
@@ -230,7 +232,7 @@ const measureInlines = (
230232 }
231233 const lineWidth = line . reduce ( ( acc , i ) => acc + i . width , 0 ) ;
232234 const lineHeight = line . reduce (
233- ( acc , i ) => Math . max ( acc , i . height ) ,
235+ ( acc , i ) => max ( acc , i . height ) ,
234236 textHeight ( ) ,
235237 ) ;
236238
0 commit comments