Skip to content

Commit fafd9e4

Browse files
committed
feat: footnote style and gfm task style
Signed-off-by: Innei <[email protected]>
1 parent 2bae0e7 commit fafd9e4

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/components/ui/markdown/Markdown.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
'use client'
22

3-
/* eslint-disable react-hooks/rules-of-hooks */
4-
import type React from 'react'
53
import { Fragment, memo, Suspense, useMemo, useRef } from 'react'
64
import { clsx } from 'clsx'
75
import { compiler, sanitizeUrl } from 'markdown-to-jsx'
86
import Script from 'next/script'
97
import type { MarkdownToJSX } from 'markdown-to-jsx'
8+
/* eslint-disable react-hooks/rules-of-hooks */
9+
import type React from 'react'
1010
import type { FC, PropsWithChildren } from 'react'
1111

1212
import { CodeBlockRender } from '~/components/modules/shared/CodeBlock'
@@ -139,6 +139,7 @@ export const Markdown: FC<MdProps & MarkdownToJSX.Options & PropsWithChildren> =
139139
key={state?.key}
140140
checked={node.completed}
141141
readOnly
142+
className="!size-[1em]"
142143
/>
143144
)
144145
},

src/components/ui/markdown/renderers/footnotes.tsx

+14-14
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import { redHighlight } from '../utils/redHighlight'
1010

1111
export const MFootNote: FC<PropsWithChildren> = (props) => {
1212
return (
13-
<div className="children:my-2 children:leading-6 children:text-base mt-4">
13+
<div id="md-footnote" className="mt-4">
1414
<Divider />
15-
{React.Children.map(props.children, (child) => {
16-
if (React.isValidElement(child)) {
17-
const id = child.props.id
18-
return (
19-
<div id={`${getFootNoteDomId(id)}`}>
20-
<div className="inline">
15+
<ul className="list-[upper-roman] space-y-3 text-base text-zinc-600 dark:text-neutral-400">
16+
{React.Children.map(props.children, (child) => {
17+
if (React.isValidElement(child)) {
18+
const id = child.props.id
19+
return (
20+
<li id={`${getFootNoteDomId(id)}`} key={id}>
2121
{React.cloneElement(child as React.ReactElement, {
2222
className: 'inline',
2323
})}
@@ -39,13 +39,13 @@ export const MFootNote: FC<PropsWithChildren> = (props) => {
3939
{id}
4040
</span>
4141
</a>
42-
</div>
43-
</div>
44-
)
45-
} else {
46-
return null // 或者其他处理方式
47-
}
48-
})}
42+
</li>
43+
)
44+
} else {
45+
return null // 或者其他处理方式
46+
}
47+
})}
48+
</ul>
4949
</div>
5050
)
5151
}

0 commit comments

Comments
 (0)