From 9e4566b44a639bfd087bbff2df1a156a78fe8023 Mon Sep 17 00:00:00 2001 From: Teresa Tian Date: Tue, 8 Jul 2025 03:32:49 -0400 Subject: [PATCH] fix table cell css select --- src/utils.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index bac5367..dca2420 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -229,18 +229,15 @@ export const initRenderer = ({ customRenderer.tablecell = (content, flags) => { const type = flags.header ? "th" : "td"; - const tag = flags.align - ? `<${type} align="${flags.align}"${ - parseCssInJsToInlineCss(finalStyles.td) !== "" - ? ` style="${parseCssInJsToInlineCss(finalStyles.td)}"` - : "" - }>` - : `<${type}${ - parseCssInJsToInlineCss(finalStyles.td) !== "" - ? ` style="${parseCssInJsToInlineCss(finalStyles.td)}"` - : "" - }>`; - return tag + content + `\n`; + const styles = parseCssInJsToInlineCss( + finalStyles[flags.header ? "th" : "td"] + ); + const tag = flags.align + ? `<${type} align="${flags.align}"${ + styles !== "" ? ` style="${styles}"` : "" + }>` + : `<${type}${styles !== "" ? ` style="${styles}"` : ""}>`; + return tag + content + `\n`; } customRenderer.tablerow = (content) => {