Skip to content

Commit

Permalink
修复幻灯片内容处理逻辑,确保非标题行在非首行时前缀为“##”
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Dec 18, 2024
1 parent 55065d5 commit 273f056
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Slides/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export function Slides(props: { initValue: string }) {
>
<div className="slides">
{props.initValue?.split('\n##').map((line, index) => {
let content = line;
if (!line?.startsWith('#') && index !== 0) {
content = `##` + content;
}
return (
<section key={index}>
<MarkdownEditor
Expand All @@ -54,7 +58,7 @@ export function Slides(props: { initValue: string }) {
height: '100%',
overflow: 'hidden',
}}
initValue={line?.startsWith('#') ? line : `##` + line}
initValue={content}
/>
</section>
);
Expand Down

0 comments on commit 273f056

Please sign in to comment.