mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
31
extensions/markdown-math/src/extension.ts
Normal file
31
extensions/markdown-math/src/extension.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
const enabledSetting = 'markdown.math.enabled';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
function isEnabled(): boolean {
|
||||
const config = vscode.workspace.getConfiguration('markdown');
|
||||
console.log(config.get<boolean>('math.enabled', true));
|
||||
return config.get<boolean>('math.enabled', true);
|
||||
}
|
||||
|
||||
vscode.workspace.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration(enabledSetting)) {
|
||||
vscode.commands.executeCommand('markdown.api.reloadPlugins');
|
||||
}
|
||||
}, undefined, context.subscriptions);
|
||||
|
||||
return {
|
||||
extendMarkdownIt(md: any) {
|
||||
if (isEnabled()) {
|
||||
const katex = require('@iktakahiro/markdown-it-katex');
|
||||
return md.use(katex);
|
||||
}
|
||||
return md;
|
||||
}
|
||||
};
|
||||
}
|
||||
1
extensions/markdown-math/src/types.d.ts
vendored
Normal file
1
extensions/markdown-math/src/types.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference path='../../../src/vs/vscode.d.ts'/>
|
||||
Reference in New Issue
Block a user