mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Render JSDoc examples as typescript code (#234143)
Currently `@example` produces Markdown code blocks for code examples, but they are not annotated with a programming language. This commit annotates those code blocks as `typescript`, allowing for better highlighting for JS/TS when using Markdown renderers that recognize these languages.
This commit is contained in:
@@ -28,7 +28,7 @@ function getTagBodyText(
|
||||
if (/^\s*[~`]{3}/m.test(text)) {
|
||||
return text;
|
||||
}
|
||||
return '```\n' + text + '\n```';
|
||||
return '```tsx\n' + text + '\n```';
|
||||
}
|
||||
|
||||
let text = convertLinkTags(tag.text, filePathConverter);
|
||||
|
||||
@@ -89,7 +89,7 @@ suite('typescript.previewer', () => {
|
||||
text: 'code();'
|
||||
}
|
||||
], noopToResource),
|
||||
'*@example* \n```\ncode();\n```'
|
||||
'*@example* \n```tsx\ncode();\n```'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -113,7 +113,7 @@ suite('typescript.previewer', () => {
|
||||
text: '<caption>Not code</caption>\ncode();'
|
||||
}
|
||||
], noopToResource),
|
||||
'*@example* \nNot code\n```\ncode();\n```'
|
||||
'*@example* \nNot code\n```tsx\ncode();\n```'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -154,7 +154,7 @@ suite('typescript.previewer', () => {
|
||||
]
|
||||
}
|
||||
], noopToResource),
|
||||
'*@example* \n```\n1 + 1 {@link foo}\n```');
|
||||
'*@example* \n```tsx\n1 + 1 {@link foo}\n```');
|
||||
});
|
||||
|
||||
test('Should render @linkcode symbol name as code', () => {
|
||||
|
||||
Reference in New Issue
Block a user