mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
This implements the api described in #123540. Major points: - Instead of having the `markdown-it` renderer pull it its dependencies, instead the dependencies can call `getRenderer` to import the object returned by the `markdown-it` renderer - We try to detect if a renderer is using the old or new api. Old renderers are still run as globals while new ones are loaded with `import` - I have only hooked up the new API for markdown renderers so far
18 lines
686 B
TypeScript
18 lines
686 B
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
import type * as markdownIt from 'markdown-it';
|
|
|
|
const emoji = require('markdown-it-emoji');
|
|
|
|
export function activate(ctx: {
|
|
getRenderer: (id: string) => any
|
|
}) {
|
|
const markdownItRenderer = ctx.getRenderer('markdownItRenderer');
|
|
|
|
markdownItRenderer.extendMarkdownIt((md: markdownIt.MarkdownIt) => {
|
|
return md.use(emoji);
|
|
});
|
|
}
|