aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/pages
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-09-20 20:16:30 +0800
committercrupest <crupest@outlook.com>2023-09-20 20:16:30 +0800
commit901fe3d7c032d284da5c9bce24c4aaee9054c7ac (patch)
tree573cfafd972106d69bef0d41ff5f270ec3c43ec2 /FrontEnd/src/pages
parent4165ca210d9660a67b16089c31b7f65b8b09e019 (diff)
downloadtimeline-901fe3d7c032d284da5c9bce24c4aaee9054c7ac.tar.gz
timeline-901fe3d7c032d284da5c9bce24c4aaee9054c7ac.tar.bz2
timeline-901fe3d7c032d284da5c9bce24c4aaee9054c7ac.zip
Fix lint errors.
Diffstat (limited to 'FrontEnd/src/pages')
-rw-r--r--FrontEnd/src/pages/timeline/edit/MarkdownPostEdit.tsx17
-rw-r--r--FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx3
2 files changed, 8 insertions, 12 deletions
diff --git a/FrontEnd/src/pages/timeline/edit/MarkdownPostEdit.tsx b/FrontEnd/src/pages/timeline/edit/MarkdownPostEdit.tsx
index 692221fd..36a5572b 100644
--- a/FrontEnd/src/pages/timeline/edit/MarkdownPostEdit.tsx
+++ b/FrontEnd/src/pages/timeline/edit/MarkdownPostEdit.tsx
@@ -19,24 +19,21 @@ class MarkedRenderer extends marked.Renderer {
}
// Custom image parser for indexed image link.
- image(href: string | null, title: string | null, text: string): string {
- if (href != null) {
- const i = parseInt(href);
- if (!isNaN(i) && i > 0 && i <= this.images.length) {
- href = this.images[i - 1];
- }
+ image(href: string, title: string | null, text: string): string {
+ const i = parseInt(href);
+ if (!isNaN(i) && i > 0 && i <= this.images.length) {
+ href = this.images[i - 1];
}
return super.image(href, title, text);
}
}
-function generateMarkedOptions(imageUrls: string[]): marked.MarkedOptions {
+function generateMarkedOptions(imageUrls: string[]) {
return {
- mangle: false,
- headerIds: false,
renderer: new MarkedRenderer(imageUrls),
- };
+ async: false,
+ } as const;
}
function renderHtml(text: string, imageUrls: string[]): string {
diff --git a/FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx b/FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx
index caf6eef0..9bb9f980 100644
--- a/FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx
+++ b/FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx
@@ -40,8 +40,7 @@ export default function MarkdownPostView({
const markdownHtml = useMemo<string | null>(() => {
if (markdown == null) return null;
return marked.parse(markdown, {
- mangle: false,
- headerIds: false,
+ async: false,
});
}, [markdown]);