提交 69a30b65 编写于 作者: J Johannes Rieken

tsfmt - extensions/markdown

上级 507b5514
......@@ -92,8 +92,8 @@ function showPreview(uri?: Uri, sideBySide: boolean = false) {
`Preview '${path.basename(resource.fsPath)}'`);
telemetryReporter.sendTelemetryEvent('openPreview', {
where : sideBySide ? 'sideBySide' : 'inPlace',
how : (uri instanceof Uri) ? 'action' : 'pallete'
where: sideBySide ? 'sideBySide' : 'inPlace',
how: (uri instanceof Uri) ? 'action' : 'pallete'
});
return thenable;
......@@ -151,14 +151,14 @@ function getPackageInfo(context: ExtensionContext): IPackageInfo {
interface IRenderer {
render(text: string) : string;
render(text: string): string;
}
class MDDocumentContentProvider implements TextDocumentContentProvider {
private _context: ExtensionContext;
private _onDidChange = new EventEmitter<Uri>();
private _waiting : boolean;
private _renderer : IRenderer;
private _waiting: boolean;
private _renderer: IRenderer;
constructor(context: ExtensionContext) {
this._context = context;
......@@ -166,7 +166,7 @@ class MDDocumentContentProvider implements TextDocumentContentProvider {
this._renderer = this.createRenderer();
}
private createRenderer() : IRenderer {
private createRenderer(): IRenderer {
const hljs = require('highlight.js');
const mdnh = require('markdown-it-named-headers');
const md = require('markdown-it')({
......@@ -183,15 +183,15 @@ class MDDocumentContentProvider implements TextDocumentContentProvider {
return md;
}
private getMediaPath(mediaFile) : string {
private getMediaPath(mediaFile): string {
return this._context.asAbsolutePath(path.join('media', mediaFile));
}
private isAbsolute(p) : boolean {
private isAbsolute(p): boolean {
return path.normalize(p + '/') === path.normalize(path.resolve(p) + '/');
}
private fixHref(resource: Uri, href: string) : string {
private fixHref(resource: Uri, href: string): string {
if (href) {
// Use href if it is already an URL
if (Uri.parse(href).scheme) {
......
declare module 'vscode-extension-telemetry' {
export default class TelemetryReporter {
constructor(extensionId: string,extensionVersion: string, key: string);
constructor(extensionId: string, extensionVersion: string, key: string);
sendTelemetryEvent(eventName: string, properties?: { [key: string]: string }, measures?: { [key: string]: number }): void;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册