mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
fix generates different html content for the same markdown (#138935)
fix generates different html content for the same markdown when get the cached token
This commit is contained in:
@@ -164,6 +164,7 @@ export class MarkdownEngine {
|
||||
): Token[] {
|
||||
const cached = this._tokenCache.tryGetCached(document, config);
|
||||
if (cached) {
|
||||
this.resetSlugCount();
|
||||
return cached;
|
||||
}
|
||||
|
||||
@@ -173,10 +174,14 @@ export class MarkdownEngine {
|
||||
}
|
||||
|
||||
private tokenizeString(text: string, engine: MarkdownIt) {
|
||||
this._slugCount = new Map<string, number>();
|
||||
this.resetSlugCount();
|
||||
|
||||
return engine.parse(text.replace(UNICODE_NEWLINE_REGEX, ''), {});
|
||||
}
|
||||
|
||||
public resetSlugCount(): void {
|
||||
this._slugCount = new Map<string, number>();
|
||||
}
|
||||
|
||||
public async render(input: SkinnyTextDocument | string, resourceProvider?: WebviewResourceProvider): Promise<RenderOutput> {
|
||||
const config = this.getConfig(typeof input === 'string' ? undefined : input.uri);
|
||||
|
||||
Reference in New Issue
Block a user