Compare commits
2 Commits
bc6643a6c2
...
5feb987af6
| Author | SHA1 | Date | |
|---|---|---|---|
| 5feb987af6 | |||
| 4f1efafe52 |
46
package.json
46
package.json
@ -32,36 +32,36 @@
|
|||||||
"node": ">=16.0.0"
|
"node": ">=16.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "1.8.2",
|
"axios": "1.12.0",
|
||||||
"less": "4.3.0",
|
"less": "4.5.1",
|
||||||
"marked": "^15.0.11",
|
"marked": "^17.0.1",
|
||||||
"marked-gfm-heading-id": "^4.1.1",
|
"marked-gfm-heading-id": "^4.1.3",
|
||||||
"marked-highlight": "^2.2.1",
|
"marked-highlight": "^2.2.3",
|
||||||
"marked-mangle": "^1.1.10",
|
"marked-mangle": "^1.1.12",
|
||||||
"prismjs": "1.30.0",
|
"prismjs": "1.30.0",
|
||||||
"terser": "^5.39.0"
|
"terser": "^5.44.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/marked": "^6.0.0",
|
"@types/marked": "^6.0.0",
|
||||||
"@types/node": "^22.15.2",
|
"@types/node": "^25.0.8",
|
||||||
"@types/prismjs": "1.26.5",
|
"@types/prismjs": "1.26.5",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.31.0",
|
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
||||||
"@typescript-eslint/parser": "^8.31.0",
|
"@typescript-eslint/parser": "^8.53.0",
|
||||||
"@vitejs/plugin-vue": "^5.2.3",
|
"@vitejs/plugin-vue": "^6.0.3",
|
||||||
"eslint": "^9.25.1",
|
"eslint": "^9.39.2",
|
||||||
"eslint-config-prettier": "^10.1.2",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-define-config": "^2.1.0",
|
"eslint-define-config": "^2.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.6",
|
"eslint-plugin-prettier": "^5.5.5",
|
||||||
"eslint-plugin-vue": "^10.0.0",
|
"eslint-plugin-vue": "^10.6.2",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.8.0",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.9.3",
|
||||||
"unplugin-auto-import": "^19.1.2",
|
"unplugin-auto-import": "^21.0.0",
|
||||||
"unplugin-vue-components": "^28.5.0",
|
"unplugin-vue-components": "^31.0.0",
|
||||||
"vite": "6.2.6",
|
"vite": "7.1.11",
|
||||||
"vite-plugin-dts": "^4.5.3",
|
"vite-plugin-dts": "^4.5.4",
|
||||||
"vite-plugin-prismjs": "^0.0.11",
|
"vite-plugin-prismjs": "^0.0.11",
|
||||||
"vite-plugin-vue-setup-extend": "^0.4.0",
|
"vite-plugin-vue-setup-extend": "^0.4.0",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.26",
|
||||||
"vue-tsc": "^2.2.10"
|
"vue-tsc": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1721
pnpm-lock.yaml
generated
1721
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@ defineOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
|
code?: string;
|
||||||
content?: string;
|
content?: string;
|
||||||
showCodeBorder?: boolean;
|
showCodeBorder?: boolean;
|
||||||
maxHeight?: string;
|
maxHeight?: string;
|
||||||
@ -25,13 +26,27 @@ const props = withDefaults(defineProps<{
|
|||||||
const { content } = toRefs(props);
|
const { content } = toRefs(props);
|
||||||
const markdownHTML = ref("");
|
const markdownHTML = ref("");
|
||||||
|
|
||||||
|
const buildMarkdown = () => {
|
||||||
|
if (props.code) {
|
||||||
|
const codeRaw = props.code ?? "";
|
||||||
|
const sepIndex = codeRaw.indexOf(":");
|
||||||
|
const lang = sepIndex < 0 ? "" : codeRaw.slice(0, sepIndex).trim();
|
||||||
|
const codeText = sepIndex < 0 ? codeRaw : codeRaw.slice(sepIndex + 1);
|
||||||
|
const langTag = lang ? lang : "";
|
||||||
|
|
||||||
|
return `\`\`\`${langTag}\n${codeText}\n\`\`\``;
|
||||||
|
}
|
||||||
|
return content.value;
|
||||||
|
};
|
||||||
|
|
||||||
const doRender = async () => {
|
const doRender = async () => {
|
||||||
markdownHTML.value = await Markdown.getInstance().toHTML(content.value);
|
const markdownText = buildMarkdown();
|
||||||
|
markdownHTML.value = await Markdown.getInstance().toHTML(markdownText);
|
||||||
await nextTick();
|
await nextTick();
|
||||||
Prism.highlightAll();
|
Prism.highlightAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(() => props.content, doRender);
|
watch(() => [props.code, props.content], doRender);
|
||||||
onMounted(doRender);
|
onMounted(doRender);
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@ -423,4 +423,11 @@ export default class Toolkit {
|
|||||||
}
|
}
|
||||||
}, interval);
|
}, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static formatJson(jsonStr?: string): string {
|
||||||
|
if (!jsonStr) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return JSON.stringify(JSON.parse(jsonStr), null, 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,8 @@
|
|||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
"examples/**/*.ts",
|
"examples/**/*.ts",
|
||||||
"examples/**/*.d.ts",
|
"examples/**/*.d.ts",
|
||||||
"examples/**/*.vue"
|
"examples/**/*.vue",
|
||||||
|
"node_modules/.pnpm/unplugin-auto-import@19.1.2/node_modules/unplugin-auto-import/auto-imports.d.ts"
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user