mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 04:09:28 +00:00
Adding support for RTL languages for readme markdown preview. (#139644)
* [markdown preview] dir "auto" added to the markdown-body class. * fix markdown preview for RTL languages
This commit is contained in:
committed by
GitHub
parent
883009bf0f
commit
2a0d371ca3
@@ -111,7 +111,7 @@ export class MarkdownContentProvider {
|
|||||||
resourceProvider: WebviewResourceProvider,
|
resourceProvider: WebviewResourceProvider,
|
||||||
): Promise<MarkdownContentProviderOutput> {
|
): Promise<MarkdownContentProviderOutput> {
|
||||||
const rendered = await this.engine.render(markdownDocument, resourceProvider);
|
const rendered = await this.engine.render(markdownDocument, resourceProvider);
|
||||||
const html = `<div class="markdown-body">${rendered.html}<div class="code-line" data-line="${markdownDocument.lineCount}"></div></div>`;
|
const html = `<div class="markdown-body" dir="auto">${rendered.html}<div class="code-line" data-line="${markdownDocument.lineCount}"></div></div>`;
|
||||||
return {
|
return {
|
||||||
html,
|
html,
|
||||||
containingImages: rendered.containingImages
|
containingImages: rendered.containingImages
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ const pluginSourceMap: MarkdownIt.PluginSimple = (md): void => {
|
|||||||
if (token.map && token.type !== 'inline') {
|
if (token.map && token.type !== 'inline') {
|
||||||
token.attrSet('data-line', String(token.map[0]));
|
token.attrSet('data-line', String(token.map[0]));
|
||||||
token.attrJoin('class', 'code-line');
|
token.attrJoin('class', 'code-line');
|
||||||
|
token.attrJoin('dir', 'auto');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -178,7 +179,7 @@ export class MarkdownEngine {
|
|||||||
|
|
||||||
return engine.parse(text.replace(UNICODE_NEWLINE_REGEX, ''), {});
|
return engine.parse(text.replace(UNICODE_NEWLINE_REGEX, ''), {});
|
||||||
}
|
}
|
||||||
|
|
||||||
public resetSlugCount(): void {
|
public resetSlugCount(): void {
|
||||||
this._slugCount = new Map<string, number>();
|
this._slugCount = new Map<string, number>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user