Skip to content

Commit

Permalink
fix list numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
cogentapps authored Mar 19, 2023
1 parent 583eab2 commit 216ecd5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export function Markdown(props: MarkdownProps) {
remarkPlugins={[remarkGfm, remarkMath]}
rehypePlugins={[rehypeKatex]}
components={{
ol({ start, children }) {
return <ol start={start ?? 1} style={{ counterReset: `list-item ${(start || 1) - 1}` }}>
{children}
</ol>;
},
code({ node, inline, className, children, ...props }) {
const match = /language-(\w+)/.exec(className || '')
const code = String(children);
Expand Down Expand Up @@ -128,4 +133,4 @@ export function Markdown(props: MarkdownProps) {
), [props.content, classes, intl]);

return elem;
}
}

0 comments on commit 216ecd5

Please sign in to comment.