Skip to content

Commit 7f35c81

Browse files
fix: use correct styles for table header cells (th) vs data cells (td) (#37)
1 parent fa1785b commit 7f35c81

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

src/utils.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,18 +229,15 @@ export const initRenderer = ({
229229

230230
customRenderer.tablecell = (content, flags) => {
231231
const type = flags.header ? "th" : "td";
232-
const tag = flags.align
233-
? `<${type} align="${flags.align}"${
234-
parseCssInJsToInlineCss(finalStyles.td) !== ""
235-
? ` style="${parseCssInJsToInlineCss(finalStyles.td)}"`
236-
: ""
237-
}>`
238-
: `<${type}${
239-
parseCssInJsToInlineCss(finalStyles.td) !== ""
240-
? ` style="${parseCssInJsToInlineCss(finalStyles.td)}"`
241-
: ""
242-
}>`;
243-
return tag + content + `</${type}>\n`;
232+
const styles = parseCssInJsToInlineCss(
233+
finalStyles[flags.header ? "th" : "td"]
234+
);
235+
const tag = flags.align
236+
? `<${type} align="${flags.align}"${
237+
styles !== "" ? ` style="${styles}"` : ""
238+
}>`
239+
: `<${type}${styles !== "" ? ` style="${styles}"` : ""}>`;
240+
return tag + content + `</${type}>\n`;
244241
}
245242

246243
customRenderer.tablerow = (content) => {

0 commit comments

Comments
 (0)