Add basic mermaid rendering support in core

For #257761

Ports over extension sample + a few improvements to core
This commit is contained in:
Matt Bierner
2025-09-10 18:22:39 -07:00
parent b40ad39197
commit c7e7a779e8
21 changed files with 2362 additions and 4 deletions

View File

@@ -0,0 +1,75 @@
{
"name": "marmaid-chat-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"publisher": "vscode",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
},
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.104.0"
},
"enabledApiProposals": [
"chatOutputRenderer"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": true
}
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"activationEvents": [],
"contributes": {
"chatOutputRenderers": [
{
"viewType": "vscode.chatMermaidDiagram",
"mimeTypes": [
"text/vnd.mermaid"
]
}
],
"languageModelTools": [
{
"name": "renderMermaidDiagram",
"displayName": "Mermaid Renderer",
"toolReferenceName": "renderMermaidDiagram",
"canBeReferencedInPrompt": true,
"modelDescription": "Renders a Mermaid diagram from Mermaid.js markup.",
"userDescription": "Render a Mermaid.js diagrams from markup.",
"inputSchema": {
"type": "object",
"properties": {
"markup": {
"type": "string",
"description": "The mermaid diagram markup to render as a Mermaid diagram. This should only be the markup of the diagram. Do not include a wrapping code block."
}
}
}
}
]
},
"scripts": {
"compile": "gulp compile-extension:mermaid-chat-features && npm run build-chat-webview",
"watch": "npm run build-chat-webview && gulp watch-extension:mermaid-chat-features",
"vscode:prepublish": "npm run build-ext && npm run build-chat-webview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:mermaid-chat-features ./tsconfig.json",
"build-chat-webview": "node ./esbuild-chat-webview.mjs",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"devDependencies": {
"@types/jsdom": "^21.1.7",
"@types/node": "^22"
},
"dependencies": {
"dompurify": "^3.2.6",
"jsdom": "^26.1.0",
"mermaid": "^11.11.0"
}
}