diff --git a/.changeset/add_table_styling.md b/.changeset/add_table_styling.md new file mode 100644 index 000000000..46c3bff8c --- /dev/null +++ b/.changeset/add_table_styling.md @@ -0,0 +1,5 @@ +--- +default: minor +--- + +# Add table styling diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx index 17cbb84fb..013b46183 100644 --- a/src/app/plugins/react-custom-html-parser.tsx +++ b/src/app/plugins/react-custom-html-parser.tsx @@ -760,6 +760,30 @@ export const getReactCustomHtmlParser = ( ); } + if (name === 'table') { + return ( +
+ + {renderChildren()} +
+
+ ); + } + if (name === 'th') { + return ( + + {renderChildren()} + + ); + } + if (name === 'td') { + return ( + + {renderChildren()} + + ); + } + if (name === 'code') { if (parent && 'name' in parent && parent.name === 'pre') { const codeContent = renderChildren(); diff --git a/src/app/styles/CustomHtml.css.ts b/src/app/styles/CustomHtml.css.ts index 2b7772949..a3a6f01b4 100644 --- a/src/app/styles/CustomHtml.css.ts +++ b/src/app/styles/CustomHtml.css.ts @@ -300,3 +300,41 @@ export const HorizontalRule = style([ userSelect: 'none', }, ]); + +export const TableContainer = style([ + DefaultReset, + MarginSpaced, + { + overflowX: 'auto', + maxWidth: '100%', + }, +]); + +export const Table = style([ + DefaultReset, + { + borderCollapse: 'collapse', + }, +]); + +export const Th = style([ + DefaultReset, + { + padding: `${config.space.S100} ${config.space.S200}`, + border: `${config.borderWidth.B300} solid ${color.SurfaceVariant.ContainerLine}`, + backgroundColor: color.SurfaceVariant.Container, + color: color.SurfaceVariant.OnContainer, + minWidth: toRem(100), + }, +]); + +export const Td = style([ + DefaultReset, + { + padding: `${config.space.S100} ${config.space.S200}`, + border: `${config.borderWidth.B300} solid ${color.Surface.ContainerLine}`, + backgroundColor: color.Surface.Container, + color: color.Surface.OnContainer, + minWidth: toRem(100), + }, +]);