style: 格式化项目代码
- 根据prettier配置格式化整个项目的代码
This commit is contained in:
@ -8,5 +8,5 @@ export function formatFileSize(sizeInKB: number): string {
|
||||
}
|
||||
|
||||
export function formatFileExtension(ext: string): string {
|
||||
return ext.startsWith(".") ? ext.slice(1).toUpperCase() : ext.toUpperCase();
|
||||
return ext.startsWith('.') ? ext.slice(1).toUpperCase() : ext.toUpperCase();
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import MarkdownIt from "markdown-it";
|
||||
import MarkdownIt from 'markdown-it';
|
||||
|
||||
const md = new MarkdownIt({
|
||||
html: true,
|
||||
@ -10,8 +10,8 @@ const md = new MarkdownIt({
|
||||
export function renderMarkdown(content: string): string {
|
||||
const dirtyHtml = md.render(content);
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
import("dompurify").then((DOMPurify) => {
|
||||
if (typeof window !== 'undefined') {
|
||||
import('dompurify').then((DOMPurify) => {
|
||||
return DOMPurify.default.sanitize(dirtyHtml);
|
||||
});
|
||||
}
|
||||
@ -23,7 +23,7 @@ export function convertMedia(content: string): string {
|
||||
// 通过正则表达式替换Markdown中的图片链接
|
||||
//  -> )
|
||||
|
||||
if (!content) return "";
|
||||
if (!content) return '';
|
||||
|
||||
const contentWithAbsoluteUrls = content.replace(
|
||||
/!\[([^\]]*)\]\((\/uploads\/[^)]+)\)/g,
|
||||
|
||||
Reference in New Issue
Block a user