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

@ -6,7 +6,6 @@ import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import "dayjs/locale/zh";
import { UNKNOWN_ID } from "../helpers/consts";
import { DONE_BLOCK_REG, TODO_BLOCK_REG } from "../helpers/marked";
import { editorStateService, locationService, memoService, userService } from "../services";
import Icon from "./Icon";
import toastHelper from "./Toast";
@ -134,7 +133,7 @@ const Memo: React.FC<Props> = (props: Props) => {
for (const element of todoElementList) {
if (element === targetEl) {
const index = indexOf(todoElementList, element);
const tempList = memo.content.split(status === "DONE" ? DONE_BLOCK_REG : TODO_BLOCK_REG);
const tempList = memo.content.split(status === "DONE" ? /- \[x\] / : /- \[ \] /);
let finalContent = "";
for (let i = 0; i < tempList.length; i++) {