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.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: fix math block matcher
Stevend7ed59581c09
diff --git a/plugin/gomark/ast/ast.go b/plugin/gomark/ast/ast.goindex a1416d3d0..9bf2fba7e 100644--- a/plugin/gomark/ast/ast.go+++ b/plugin/gomark/ast/ast.go@@ -74,7 +74,7 @@ func (n *BaseNode) SetNextSibling(node Node) {func IsBlockNode(node Node) bool {switch node.Type() {- case ParagraphNode, CodeBlockNode, HeadingNode, HorizontalRuleNode, BlockquoteNode, OrderedListNode, UnorderedListNode, TaskListNode:+ case ParagraphNode, CodeBlockNode, HeadingNode, HorizontalRuleNode, BlockquoteNode, OrderedListNode, UnorderedListNode, TaskListNode, MathBlockNode:return truedefault:return falsediff --git a/plugin/gomark/parser/math_block.go b/plugin/gomark/parser/math_block.goindex ad3a78527..41c0a8ebb 100644--- a/plugin/gomark/parser/math_block.go+++ b/plugin/gomark/parser/math_block.go@@ -18,7 +18,7 @@ func (*MathBlockParser) Match(tokens []*tokenizer.Token) (int, bool) {return 0, false}- if tokens[0].Type != tokenizer.DollarSign && tokens[1].Type != tokenizer.DollarSign && tokens[2].Type != tokenizer.Newline {+ if tokens[0].Type != tokenizer.DollarSign || tokens[1].Type != tokenizer.DollarSign || tokens[2].Type != tokenizer.Newline {return 0, false}diff --git a/plugin/gomark/parser/math_block_test.go b/plugin/gomark/parser/math_block_test.goindex 5f489980c..cc7bff936 100644--- a/plugin/gomark/parser/math_block_test.go+++ b/plugin/gomark/parser/math_block_test.go@@ -21,6 +21,12 @@ func TestMathBlockParser(t *testing.T) {Content: "(1+x)^2",},},+ {+ text: "$$\na=3\n$$",+ link: &ast.MathBlock{+ Content: "a=3",+ },+ },}for _, test := range tests {tokens := tokenizer.Tokenize(test.text)diff --git a/plugin/gomark/parser/parser_test.go b/plugin/gomark/parser/parser_test.goindex 2d5effaba..197da2554 100644--- a/plugin/gomark/parser/parser_test.go+++ b/plugin/gomark/parser/parser_test.go@@ -197,6 +197,22 @@ func TestParser(t *testing.T) {},},},+ {+ text: "\n\n",+ nodes: []ast.Node{+ &ast.LineBreak{},+ &ast.LineBreak{},+ },+ },+ {+ text: "\n$$\na=3\n$$",+ nodes: []ast.Node{+ &ast.LineBreak{},+ &ast.MathBlock{+ Content: "a=3",+ },+ },+ },}for _, test := range tests {