Skip to content

Commit 6cd740a

Browse files
committed
Fix heading styles
1 parent 5cbf88e commit 6cd740a

2 files changed

Lines changed: 31 additions & 15 deletions

File tree

services/backend-api/client/src/components/DiscordView/utils/markdown.jsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,8 @@ const baseRules = {
177177
};
178178
},
179179
react(node, recurseOutput, state) {
180-
const sizes = {
181-
1: "1.5rem",
182-
2: "1.25rem",
183-
3: "1rem",
184-
};
185-
const style = {
186-
fontWeight: "bold",
187-
fontSize: sizes[node.level] || "1rem",
188-
lineHeight: "1.375",
189-
marginTop: "1rem",
190-
marginBottom: "0.5rem",
191-
};
192-
193180
return (
194-
<div key={state.key} style={style}>
181+
<div key={state.key} className={`markdown-heading markdown-heading-${node.level}`}>
195182
{recurseOutput(node.content, state)}
196183
</div>
197184
);
@@ -346,7 +333,11 @@ function createRules(r) {
346333
paragraph: {
347334
...paragraph,
348335
react(node, recurseOutput, state) {
349-
return <p key={state.key}>{recurseOutput(node.content, state)}</p>;
336+
return (
337+
<p key={state.key} style={{ margin: 0 }}>
338+
{recurseOutput(node.content, state)}
339+
</p>
340+
);
350341
},
351342
},
352343
url: {

services/backend-api/client/src/discord.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,3 +1118,28 @@
11181118
color: #00b0f4;
11191119
text-decoration: none
11201120
}
1121+
1122+
/* Markdown Headings */
1123+
.markdown-heading {
1124+
font-weight: bold;
1125+
line-height: 1.375;
1126+
margin-top: 1rem;
1127+
margin-bottom: 0.5rem;
1128+
color: white;
1129+
}
1130+
1131+
.markdown-heading:first-child {
1132+
margin-top: 0;
1133+
}
1134+
1135+
.markdown-heading-1 {
1136+
font-size: 1.5rem;
1137+
}
1138+
1139+
.markdown-heading-2 {
1140+
font-size: 1.25rem;
1141+
}
1142+
1143+
.markdown-heading-3 {
1144+
font-size: 1rem;
1145+
}

0 commit comments

Comments
 (0)