Skip to content

Commit a1f6d64

Browse files
authored
🐛 Modify markdown page rendering
2 parents 39121bc + 2539cde commit a1f6d64

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

frontend/components/ui/markdownRenderer.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,18 @@ export const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({
564564
hr: () => (
565565
<hr className="markdown-hr" />
566566
),
567+
// Ordered list
568+
ol: ({ children }: any) => (
569+
<ol className="markdown-ol">
570+
{children}
571+
</ol>
572+
),
573+
// Unordered list
574+
ul: ({ children }: any) => (
575+
<ul className="markdown-ul">
576+
{children}
577+
</ul>
578+
),
567579
// List item
568580
li: ({ children }: any) => (
569581
<li className="markdown-li">

frontend/styles/react-markdown.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,42 @@
110110
border-radius: 1px;
111111
}
112112

113+
/* List Styles */
114+
.markdown-ol {
115+
margin: 0.5rem 0;
116+
padding-left: 1.5rem;
117+
list-style-type: decimal;
118+
list-style-position: outside;
119+
}
120+
121+
.markdown-ul {
122+
margin: 0.5rem 0;
123+
padding-left: 1.5rem;
124+
list-style-type: disc;
125+
list-style-position: outside;
126+
}
127+
113128
/* List Item Styles */
114129
.markdown-li {
115130
margin-bottom: 0.25rem;
116131
color: var(--color-nord0);
117132
}
118133

134+
/* Remove extra spacing from paragraphs inside list items */
135+
.markdown-ol li > p,
136+
.markdown-ul li > p,
137+
.markdown-li > p {
138+
margin-top: 0 !important;
139+
margin-bottom: 0 !important;
140+
}
141+
142+
/* Preserve spacing only between multiple paragraphs within same list item */
143+
.markdown-ol li > p + p,
144+
.markdown-ul li > p + p,
145+
.markdown-li > p + p {
146+
margin-top: 0.5rem !important;
147+
}
148+
119149
/* Blockquote Styles */
120150
.markdown-blockquote {
121151
border-left: 4px solid #d1d5db;

0 commit comments

Comments
 (0)