aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-04-19 17:20:20 +0800
committercrupest <crupest@outlook.com>2022-04-19 17:20:20 +0800
commitb9c770e63da37f3a33e46c69a09f21b4b8d6ad8b (patch)
tree9093585585808a35ed042677be8f5dbb8df5c1e4 /FrontEnd/src/views
parent00d61732aecbefa89b58d9dbc4c125713ddad7eb (diff)
downloadtimeline-b9c770e63da37f3a33e46c69a09f21b4b8d6ad8b.tar.gz
timeline-b9c770e63da37f3a33e46c69a09f21b4b8d6ad8b.tar.bz2
timeline-b9c770e63da37f3a33e46c69a09f21b4b8d6ad8b.zip
...
Diffstat (limited to 'FrontEnd/src/views')
-rw-r--r--FrontEnd/src/views/timeline/TimelinePostContentView.tsx15
1 files changed, 2 insertions, 13 deletions
diff --git a/FrontEnd/src/views/timeline/TimelinePostContentView.tsx b/FrontEnd/src/views/timeline/TimelinePostContentView.tsx
index 88cd756a..9e50e5cb 100644
--- a/FrontEnd/src/views/timeline/TimelinePostContentView.tsx
+++ b/FrontEnd/src/views/timeline/TimelinePostContentView.tsx
@@ -1,6 +1,6 @@
import React from "react";
import classnames from "classnames";
-import { Remarkable } from "remarkable";
+import { marked } from "marked";
import { UiLogicError } from "@/common";
@@ -88,17 +88,6 @@ const ImageView: React.FC<TimelinePostContentViewProps> = (props) => {
const MarkdownView: React.FC<TimelinePostContentViewProps> = (props) => {
const { post, className, style } = props;
- const _remarkable = React.useRef<Remarkable>();
-
- const getRemarkable = (): Remarkable => {
- if (_remarkable.current) {
- return _remarkable.current;
- } else {
- _remarkable.current = new Remarkable();
- return _remarkable.current;
- }
- };
-
const [markdown, setMarkdown] = React.useState<string | null>(null);
const [error, setError] = React.useState<"offline" | "error" | null>(null);
@@ -134,7 +123,7 @@ const MarkdownView: React.FC<TimelinePostContentViewProps> = (props) => {
const markdownHtml = React.useMemo<string | null>(() => {
if (markdown == null) return null;
- return getRemarkable().render(markdown);
+ return marked.parse(markdown);
}, [markdown]);
if (error != null) {