Skip to content

Commit e73852f

Browse files
authored
Merge pull request #3603 from IntersectMBO/feat/3581-markdown-tables-within-governance-action-metadata-are-poorly-rendered
feat(#3581): add support for tables in markdown
2 parents 96e2a9d + 5b25181 commit e73852f

File tree

6 files changed

+780
-1
lines changed

6 files changed

+780
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ changes.
1212

1313
### Added
1414

15+
- Add support for the tables in markdown [Issue 3581](https://github.com/IntersectMBO/govtool/issues/3581)
16+
1517
### Fixed
1618

1719
### Changed

govtool/frontend/package-lock.json

Lines changed: 266 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

govtool/frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"react-router-dom": "^6.13.0",
5959
"rehype-katex": "^7.0.1",
6060
"remark-breaks": "^4.0.0",
61+
"remark-gfm": "^4.0.1",
6162
"remark-math": "^6.0.0",
6263
"storybook-addon-manual-mocks": "^1.0.3",
6364
"storybook-addon-module-mock": "^1.3.4",

govtool/frontend/src/components/molecules/GovernanceActionCardElement.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { Box, Skeleton } from "@mui/material";
33
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
44
import Markdown from "react-markdown";
55
import remarkMath from "remark-math";
6+
import remarkGfm from "remark-gfm";
67
import rehypeKatex from "rehype-katex";
78
import remarkBreaks from "remark-breaks";
89
import "katex/dist/katex.min.css";
10+
import "./tableMarkdown.css";
911

1012
import { Typography, Tooltip, CopyButton, TooltipProps } from "@atoms";
1113
import { removeMarkdown } from "@/utils";
@@ -135,7 +137,7 @@ export const GovernanceActionCardElement = ({
135137
const renderMarkdown = () => (
136138
<Markdown
137139
components={markdownComponents}
138-
remarkPlugins={[remarkMath, remarkBreaks]}
140+
remarkPlugins={[remarkMath, remarkBreaks, remarkGfm]}
139141
rehypePlugins={[rehypeKatex]}
140142
>
141143
{text.toString()}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
table {
2+
margin: 32px 0;
3+
border-spacing: 0;
4+
border-collapse: collapse;
5+
}
6+
7+
table thead {
8+
background-color: #d6e2ff80;
9+
}
10+
11+
table th,
12+
table td {
13+
padding: 6px 13px;
14+
border: 1px solid #d6e2ff;
15+
}
16+
17+
table td > :last-child {
18+
margin-bottom: 0;
19+
}
20+
21+
table tr:nth-child(2n) {
22+
background-color: #d6e2ff80;
23+
}

0 commit comments

Comments
 (0)