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
fix: parser regexp for special character (#439)
boojack98667028505d
diff --git a/web/src/labs/marked/marked.test.ts b/web/src/labs/marked/marked.test.tsindex 031403229..c8d9c8491 100644--- a/web/src/labs/marked/marked.test.ts+++ b/web/src/labs/marked/marked.test.ts@@ -1,3 +1,4 @@+/* eslint-disable no-irregular-whitespace */import { describe, expect, test } from "@jest/globals";import { unescape } from "lodash-es";import { marked } from ".";@@ -170,4 +171,17 @@ text below the tableexpect(unescape(marked(t.markdown))).toBe(t.want);}});+ test("parse full width space", () => {+ const tests = [+ {+ markdown: ` line1+ line2`,+ want: `<p> line1</p>+<p> line2</p>`,+ },+ ];+ for (const t of tests) {+ expect(unescape(marked(t.markdown))).toBe(t.want);+ }+ });});diff --git a/web/src/labs/marked/parser/Blockquote.ts b/web/src/labs/marked/parser/Blockquote.tsindex a30fe6f1e..6b172f5d1 100644--- a/web/src/labs/marked/parser/Blockquote.ts+++ b/web/src/labs/marked/parser/Blockquote.ts@@ -1,6 +1,6 @@import { escape } from "lodash";-export const BLOCKQUOTE_REG = /^>\s+([\S ]+)(\n?)/;+export const BLOCKQUOTE_REG = /^>\s+(.+)(\n?)/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(BLOCKQUOTE_REG);diff --git a/web/src/labs/marked/parser/Bold.ts b/web/src/labs/marked/parser/Bold.tsindex 2667bac88..1a4083a93 100644--- a/web/src/labs/marked/parser/Bold.ts+++ b/web/src/labs/marked/parser/Bold.ts@@ -1,7 +1,7 @@import { marked } from "..";import Link from "./Link";-export const BOLD_REG = /\*\*([\S ]+?)\*\*/;+export const BOLD_REG = /\*\*(.+?)\*\*/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(BOLD_REG);diff --git a/web/src/labs/marked/parser/BoldEmphasis.ts b/web/src/labs/marked/parser/BoldEmphasis.tsindex 08d0c4019..6d5e73613 100644--- a/web/src/labs/marked/parser/BoldEmphasis.ts+++ b/web/src/labs/marked/parser/BoldEmphasis.ts@@ -1,7 +1,7 @@import { marked } from "..";import Link from "./Link";-export const BOLD_EMPHASIS_REG = /\*\*\*([\S ]+?)\*\*\*/;+export const BOLD_EMPHASIS_REG = /\*\*\*(.+?)\*\*\*/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(BOLD_EMPHASIS_REG);diff --git a/web/src/labs/marked/parser/DoneList.ts b/web/src/labs/marked/parser/DoneList.tsindex 88a3eeb54..e366f3ab6 100644--- a/web/src/labs/marked/parser/DoneList.ts+++ b/web/src/labs/marked/parser/DoneList.ts@@ -1,7 +1,7 @@import { inlineElementParserList } from ".";import { marked } from "..";-export const DONE_LIST_REG = /^- \[x\] ([\S ]+)(\n?)/;+export const DONE_LIST_REG = /^- \[x\] (.+)(\n?)/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(DONE_LIST_REG);diff --git a/web/src/labs/marked/parser/Emphasis.ts b/web/src/labs/marked/parser/Emphasis.tsindex 9b052fc62..f51e7c634 100644--- a/web/src/labs/marked/parser/Emphasis.ts+++ b/web/src/labs/marked/parser/Emphasis.ts@@ -1,7 +1,7 @@import { marked } from "..";import Link from "./Link";-export const EMPHASIS_REG = /\*([\S ]+?)\*/;+export const EMPHASIS_REG = /\*(.+?)\*/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(EMPHASIS_REG);diff --git a/web/src/labs/marked/parser/InlineCode.ts b/web/src/labs/marked/parser/InlineCode.tsindex 5eda57e33..4c40fbe8d 100644--- a/web/src/labs/marked/parser/InlineCode.ts+++ b/web/src/labs/marked/parser/InlineCode.ts@@ -1,6 +1,6 @@import { escape } from "lodash-es";-export const INLINE_CODE_REG = /`([\S ]+?)`/;+export const INLINE_CODE_REG = /`(.+?)`/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(INLINE_CODE_REG);diff --git a/web/src/labs/marked/parser/Mark.ts b/web/src/labs/marked/parser/Mark.tsindex f8cbaccb3..3b30ce235 100644--- a/web/src/labs/marked/parser/Mark.ts+++ b/web/src/labs/marked/parser/Mark.ts@@ -1,6 +1,6 @@import { escape } from "lodash-es";-export const MARK_REG = /@\[([\S ]+?)\]\((\S+?)\)/;+export const MARK_REG = /@\[(.+?)\]\((\S+?)\)/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(MARK_REG);diff --git a/web/src/labs/marked/parser/OrderedList.ts b/web/src/labs/marked/parser/OrderedList.tsindex 8b27097d6..fdc658cec 100644--- a/web/src/labs/marked/parser/OrderedList.ts+++ b/web/src/labs/marked/parser/OrderedList.ts@@ -1,7 +1,7 @@import { inlineElementParserList } from ".";import { marked } from "..";-export const ORDERED_LIST_REG = /^(\d+)\. ([\S ]+)(\n?)/;+export const ORDERED_LIST_REG = /^(\d+)\. (.+)(\n?)/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(ORDERED_LIST_REG);diff --git a/web/src/labs/marked/parser/Paragraph.ts b/web/src/labs/marked/parser/Paragraph.tsindex 676260575..a4e7b0f76 100644--- a/web/src/labs/marked/parser/Paragraph.ts+++ b/web/src/labs/marked/parser/Paragraph.ts@@ -1,7 +1,7 @@import { inlineElementParserList } from ".";import { marked } from "..";-export const PARAGRAPH_REG = /^([\S ]*)(\n?)/;+export const PARAGRAPH_REG = /^(.*)(\n?)/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(PARAGRAPH_REG);diff --git a/web/src/labs/marked/parser/PlainText.ts b/web/src/labs/marked/parser/PlainText.tsindex df90bf999..bb3fba3e8 100644--- a/web/src/labs/marked/parser/PlainText.ts+++ b/web/src/labs/marked/parser/PlainText.ts@@ -1,6 +1,6 @@import { escape } from "lodash-es";-export const PLAIN_TEXT_REG = /([\S ]+)/;+export const PLAIN_TEXT_REG = /(.+)/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(PLAIN_TEXT_REG);diff --git a/web/src/labs/marked/parser/TodoList.ts b/web/src/labs/marked/parser/TodoList.tsindex 159ae2f04..06302576f 100644--- a/web/src/labs/marked/parser/TodoList.ts+++ b/web/src/labs/marked/parser/TodoList.ts@@ -2,7 +2,7 @@ import { escape } from "lodash-es";import { inlineElementParserList } from ".";import { marked } from "..";-export const TODO_LIST_REG = /^- \[ \] ([\S ]+)(\n?)/;+export const TODO_LIST_REG = /^- \[ \] (.+)(\n?)/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(TODO_LIST_REG);diff --git a/web/src/labs/marked/parser/UnorderedList.ts b/web/src/labs/marked/parser/UnorderedList.tsindex aaaa6cf94..185979d91 100644--- a/web/src/labs/marked/parser/UnorderedList.ts+++ b/web/src/labs/marked/parser/UnorderedList.ts@@ -2,7 +2,7 @@ import { escape } from "lodash-es";import { inlineElementParserList } from ".";import { marked } from "..";-export const UNORDERED_LIST_REG = /^[*-] ([\S ]+)(\n?)/;+export const UNORDERED_LIST_REG = /^[*-] (.+)(\n?)/;const renderer = (rawStr: string): string => {const matchResult = rawStr.match(UNORDERED_LIST_REG);