Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for RTL languages for readme markdown preview. #139644

Merged
merged 2 commits into from Jan 5, 2022

Conversation

SMSadegh19
Copy link
Contributor

This PR fixes #139643

I'm solving this issue as a good-first-issue. If you think anything is wrong please help me to solve it. :)

@ghost
Copy link

ghost commented Dec 24, 2021

CLA assistant check
All CLA requirements met.

Copy link
Contributor

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one question if we can get away with just setting it on the top level element

@@ -25,6 +25,7 @@ const pluginSourceMap: MarkdownIt.PluginSimple = (md): void => {
if (token.map && token.type !== 'inline') {
token.attrSet('data-line', String(token.map[0]));
token.attrJoin('class', 'code-line');
token.attrJoin('dir', 'auto');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required or is dir inherited by child elements?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjbvz

It is required. Because dir="auto" just looks at the first paragraph and apply direction to all the child element.
Childs just inherit rtl or ltr. Childs doesn't inherit auto and it is not so smart.

I think we can only add dir="auto" to the code-line classes (childs). But for markdown-body class is optional.

@@ -178,7 +179,7 @@ export class MarkdownEngine {

return engine.parse(text.replace(UNICODE_NEWLINE_REGEX, ''), {});
}

public resetSlugCount(): void {
Copy link
Contributor Author

@SMSadegh19 SMSadegh19 Jan 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we have an empty extra line here.

@mjbvz mjbvz merged commit 2a0d371 into microsoft:main Jan 5, 2022
@mjbvz
Copy link
Contributor

mjbvz commented Jan 5, 2022

Thanks! Will be in the next VS Code insiders build and scheduled to be released as part of VS Code 1.64

@mjbvz mjbvz added this to the January 2022 milestone Jan 5, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RTL support for markdown readme preview
3 participants