Escape special marks so they display in gutter (fixes #8935) (#8936)

This commit is contained in:
Rin 2024-03-26 09:06:28 +08:00 committed by GitHub
parent 5dd3810926
commit f7a3ff5e30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,6 +16,16 @@ class DecorationImpl {
private _markDecorationCache = new Map<string, vscode.TextEditorDecorationType>();
private _createMarkDecoration(name: string): vscode.TextEditorDecorationType {
const escape: Record<string, string> = {
'<': '&lt;',
'>': '&gt;',
'&': '&amp;',
'"': '&quot;',
"'": '&#39;',
};
if (name in escape) {
name = escape[name];
}
const svg = [
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">',
'<style>text { font-family: sans-serif; font-size: 0.8em; }</style>',