feat(markdown): introduce some padding

This commit is contained in:
Elian Doran
2026-04-17 06:32:49 +03:00
parent b84e50065c
commit 18d69f94d2
2 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
.note-detail-markdown {
.note-detail-code-editor .cm-editor {
padding-block: 0.25em;
}
.markdown-preview {
padding: 0.5em;
}
}

View File

@@ -1,12 +1,24 @@
import "./Markdown.css";
import { Marked } from "marked";
import { useMemo, useState } from "preact/hooks";
import { SanitizedHtml } from "../../react/RawHtml";
import SplitEditor from "../helpers/SplitEditor";
import { TypeWidgetProps } from "../type_widget";
const marked = new Marked({ breaks: true, gfm: true });
export default function Markdown(props: TypeWidgetProps) {
const [ content, setContent ] = useState("");
const html = useMemo(() => marked.parse(content) as string, [ content ]);
return (
<SplitEditor
noteType="code"
{...props}
previewContent={<div>Hello World</div>}
onContentChanged={setContent}
previewContent={<SanitizedHtml className="markdown-preview" html={html} />}
/>
);
}