chore: 移除部分无用代码
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m37s

This commit is contained in:
2025-11-14 11:06:09 +08:00
parent 54d0e297ea
commit 17d10a7d80
3 changed files with 1 additions and 35 deletions

View File

@ -13,11 +13,8 @@
const props = defineProps<Props>();
const contentWithAbsoluteUrls = convertMedia(props.content);
// 将 Markdown 转换成 HTML
const safeHtml = computed(() => renderMarkdown(contentWithAbsoluteUrls));
// const safeHtml = computed(() => renderMarkdown(props.content))
const safeHtml = computed(() => renderMarkdown(props.content));
const container = ref<HTMLElement | null>(null);

View File

@ -18,17 +18,3 @@ export function renderMarkdown(content: string): string {
return dirtyHtml;
}
export function convertMedia(content: string): string {
// 通过正则表达式替换Markdown中的图片链接
// ![alt text](image-url) -> ![alt text](strapiMedia(image-url))
if (!content) return '';
const contentWithAbsoluteUrls = content.replace(
/!\[([^\]]*)\]\((\/uploads\/[^)]+)\)/g,
(_, alt, url) => `![${alt}](${useStrapiMedia(url)})`
);
return contentWithAbsoluteUrls;
}

View File

@ -1,17 +0,0 @@
import { pinyin } from 'pinyin-pro';
/**
* 将汉语文本转换为拼音形式
*/
export function transliterateText(input: string): string {
if (!input) return '';
const text = input.normalize('NFKC').trim();
// 检测是否包含中文字符
if (/[\u4e00-\u9fa5]/.test(text)) {
return pinyin(text, { toneType: 'none', type: 'array' }).join('');
}
// 否则返回原文本
return text;
}