feat: simple markdown parser (#252)

* feat: simple markdown parser

* chore: rename test file name

* feat: add plain text link parser

* chore: update style
This commit is contained in:
boojack
2022-10-02 22:49:30 +08:00
committed by GitHub
parent 8e63b8f289
commit 51fb8ddb07
25 changed files with 504 additions and 179 deletions

View File

@ -2,7 +2,7 @@ import { useEffect, useRef } from "react";
import { useTranslation } from "react-i18next";
import { memoService, shortcutService } from "../services";
import { useAppSelector } from "../store";
import { IMAGE_URL_REG, LINK_URL_REG, MEMO_LINK_REG, TAG_REG } from "../helpers/marked";
import { TAG_REG, LINK_REG } from "../labs/marked/parser";
import * as utils from "../helpers/utils";
import { checkShouldShowMemoWithFilters } from "../helpers/filter";
import toastHelper from "./Toast";
@ -57,11 +57,7 @@ const MemoList = () => {
if (memoType) {
if (memoType === "NOT_TAGGED" && memo.content.match(TAG_REG) !== null) {
shouldShow = false;
} else if (memoType === "LINKED" && memo.content.match(LINK_URL_REG) === null) {
shouldShow = false;
} else if (memoType === "IMAGED" && memo.content.match(IMAGE_URL_REG) === null) {
shouldShow = false;
} else if (memoType === "CONNECTED" && memo.content.match(MEMO_LINK_REG) === null) {
} else if (memoType === "LINKED" && memo.content.match(LINK_REG) === null) {
shouldShow = false;
}
}