Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix blockquote renderer

Stevenfdbf2d8af2d7
diff --git a/plugin/gomark/parser/blockquote.go b/plugin/gomark/parser/blockquote.go
index f318bfc40..8e508364a 100644
--- a/plugin/gomark/parser/blockquote.go
+++ b/plugin/gomark/parser/blockquote.go
@@ -14,7 +14,7 @@ func NewBlockquoteParser() *BlockquoteParser {
}
func (*BlockquoteParser) Match(tokens []*tokenizer.Token) (int, bool) {
- if len(tokens) < 4 {
+ if len(tokens) < 3 {
return 0, false
}
if tokens[0].Type != tokenizer.GreaterThan || tokens[1].Type != tokenizer.Space {
diff --git a/plugin/gomark/parser/blockquote_test.go b/plugin/gomark/parser/blockquote_test.go
index d786f9434..4eb43dd86 100644
--- a/plugin/gomark/parser/blockquote_test.go
+++ b/plugin/gomark/parser/blockquote_test.go
@@ -29,6 +29,20 @@ func TestBlockquoteParser(t *testing.T) {
},
},
},
+ {
+ text: "> 你好",
+ blockquote: &ast.Blockquote{
+ Children: []ast.Node{
+ &ast.Paragraph{
+ Children: []ast.Node{
+ &ast.Text{
+ Content: "你好",
+ },
+ },
+ },
+ },
+ },
+ },
{
text: "> Hello\nworld",
blockquote: &ast.Blockquote{
diff --git a/web/src/components/MemoContent/Blockquote.tsx b/web/src/components/MemoContent/Blockquote.tsx
index baf22a083..2973118f8 100644
--- a/web/src/components/MemoContent/Blockquote.tsx
+++ b/web/src/components/MemoContent/Blockquote.tsx
@@ -8,7 +8,7 @@ interface Props extends BaseProps {
const Blockquote: React.FC<Props> = ({ children }: Props) => {
return (
- <blockquote>
+ <blockquote className="p-2 border-s-4 border-gray-300 bg-gray-50 dark:border-gray-500 dark:bg-zinc-700">
{children.map((child, index) => (
<Renderer key={`${child.type}-${index}`} index={String(index)} node={child} />
))}
diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx
index a9158e093..106bc4a0b 100644
--- a/web/src/components/MemoEditor/index.tsx
+++ b/web/src/components/MemoEditor/index.tsx
@@ -368,6 +368,7 @@ const MemoEditor = (props: Props) => {
<Editor ref={editorRef} {...editorConfig} />
<div className="relative w-full flex flex-row justify-between items-center pt-2" onFocus={(e) => e.stopPropagation()}>
<div className="flex flex-row justify-start items-center opacity-80">
+ <MarkdownMenu editorRef={editorRef} />
<TagSelector editorRef={editorRef} />
<IconButton size="sm" onClick={handleUploadFileBtnClick}>
<Icon.Image className="w-5 h-5 mx-auto" />
@@ -375,7 +376,6 @@ const MemoEditor = (props: Props) => {
<IconButton size="sm" onClick={handleAddMemoRelationBtnClick}>
<Icon.Link className="w-5 h-5 mx-auto" />
</IconButton>
- <MarkdownMenu editorRef={editorRef} />
</div>
</div>
<ResourceListView resourceList={state.resourceList} setResourceList={handleSetResourceList} />