Skip to content

Commit 273f056

Browse files
committed
修复幻灯片内容处理逻辑,确保非标题行在非首行时前缀为“##”
1 parent 55065d5 commit 273f056

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Slides/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export function Slides(props: { initValue: string }) {
4040
>
4141
<div className="slides">
4242
{props.initValue?.split('\n##').map((line, index) => {
43+
let content = line;
44+
if (!line?.startsWith('#') && index !== 0) {
45+
content = `##` + content;
46+
}
4347
return (
4448
<section key={index}>
4549
<MarkdownEditor
@@ -54,7 +58,7 @@ export function Slides(props: { initValue: string }) {
5458
height: '100%',
5559
overflow: 'hidden',
5660
}}
57-
initValue={line?.startsWith('#') ? line : `##` + line}
61+
initValue={content}
5862
/>
5963
</section>
6064
);

0 commit comments

Comments
 (0)