Skip to content
This repository was archived by the owner on Aug 8, 2025. It is now read-only.

Commit edd8895

Browse files
committed
[feature]: added horizontal line support;
1 parent 6d9fd92 commit edd8895

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/component/markdown/MarkdownToHTMLRenderer.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const parseInlineMarkdown = (line: string): React.ReactNode[] => {
1818
{ regex: /`([^`]+)`/, tag: 'code' },
1919
{ regex: /\[([^\]]+)\]\(([^)]+)\)/, tag: 'a' },
2020
{ regex: /(https?:\/\/[^\s)]+[^\s).,;:'"\]\s])/, tag: 'auto-link' },
21+
{ regex: /---/, tag: 'hr' },
2122
];
2223

2324
while (line.length) {
@@ -63,6 +64,8 @@ const parseInlineMarkdown = (line: string): React.ReactNode[] => {
6364
{match[1]}
6465
</a>
6566
);
67+
} else if (pattern.tag === 'hr') {
68+
parts.push(<hr key={parts.length} style={{ border: '1px solid #ccc', margin: '16px 0' }} />);
6669
}
6770

6871
line = remaining;

0 commit comments

Comments
 (0)