Skip to content

Commit 928ca8f

Browse files
committed
Fix margins in lists after last commit
1 parent 14d17c1 commit 928ca8f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

web/src/components/EnhancedMarkdown.astro

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const tokens = inline ? marked.Lexer.lexInline(processed) : marked.lexer(process
4040
---
4141

4242
{
43-
(function processTokens(tokens: Token[]) {
43+
(function processTokens(tokens: Token[], isListItem: boolean = false): any[] {
4444
return tokens.map((token) => {
4545
if (token.type === "code") {
4646
return <Code code={token.text} lang={token.lang || "text"} />;
@@ -62,12 +62,20 @@ const tokens = inline ? marked.Lexer.lexInline(processed) : marked.lexer(process
6262
const listItemToken = token as any;
6363

6464
if (listItemToken.tokens && listItemToken.tokens.length > 0) {
65-
const content = processTokens(listItemToken.tokens);
65+
const content = processTokens(listItemToken.tokens, true);
6666
return <li>{content}</li>;
6767
}
6868

6969
return <li>{listItemToken.text}</li>;
7070
}
71+
72+
if (token.type === "text" && isListItem) {
73+
const textToken = token as any;
74+
75+
return (
76+
<Fragment set:html={marked.parseInline(textToken.raw ?? textToken.text ?? "")} />
77+
);
78+
}
7179
}
7280

7381
if (inline) {

0 commit comments

Comments
 (0)