Conversation
|
🧙 Sourcery has finished reviewing your pull request! Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Co-authored-by: emako <[email protected]>
| @@ -0,0 +1,13 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
There was a problem hiding this comment.
Not need to create this file.
Just use the code like:
// Check current UI culture and IsSupportRTL translation setting
if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
{
string isSupportRTL = TranslationHelper.Get("IsSupportRTL",
failsafe: bool.TrueString,
domain: Assembly.GetExecutingAssembly().GetName().Name);
if (bool.TrueString.Equals(isSupportRTL, StringComparison.OrdinalIgnoreCase))
isRtl = true;
}There was a problem hiding this comment.
Removed the unnecessary Translations.config file and simplified the RTL detection to use TranslationHelper.Get() with failsafe value directly, matching the TextViewer pattern exactly. Fixed in c5f6000.
| ".mdc", ".qmd", ".rmd", ".rmarkdown", ".apib", ".mdtxt", ".mdtext" | ||
| }; | ||
|
|
||
| if (supportedExtensions.Any(ext => extension.Equals(ext, StringComparison.OrdinalIgnoreCase))) |
There was a problem hiding this comment.
You do not need to check the extension again in protected string GenerateMarkdownHtml(string path) method
There was a problem hiding this comment.
Removed the redundant extension check in GenerateMarkdownHtml method since it only processes markdown files. Simplified the RTL detection logic. Fixed in c5f6000.
Co-authored-by: emako <[email protected]>
| using System.Diagnostics; | ||
| using System.Globalization; | ||
| using System.IO; | ||
| using System.Linq; |
There was a problem hiding this comment.
Compile error, lost the using System.Linq; here
There was a problem hiding this comment.
Added the missing using System.Linq; statement to fix the compile error. Fixed in 7485b8c.
Co-authored-by: emako <[email protected]>
| } | ||
|
|
||
| var html = template.Replace("{{content}}", content) | ||
| .Replace("{{rtl}}", isRtl ? "rtl" : "ltr"); |
There was a problem hiding this comment.
Add a sapce to align the previous line of .Replace code
There was a problem hiding this comment.
Fixed the alignment by adding a space to properly align the .Replace method calls. The code now has consistent indentation. Fixed in f2c8273.
Co-authored-by: emako <[email protected]>
This PR adds comprehensive Right-to-Left (RTL) alignment support for markdown files in QuickLook, following the same pattern used in the TextViewer plugin for *.txt files.
Features Added
IsSupportRTLsettingCtrl+RightShiftfor RTL,Ctrl+LeftShiftfor LTR)Technical Implementation
Files Modified:
Translations.config(NEW) - Added RTL configuration for Arabic and Hebrew localesMarkdownPanel.cs- Added RTL detection logic similar to TextViewermd2html.html- Updated HTML template with RTL support and CSSQuickLook.Plugin.MarkdownViewer.csproj- Include translations as embedded resourceKey Changes:
The implementation follows the existing pattern from TextViewer:
The HTML template now includes:
dir="{{rtl}}"attribute on the<html>elementVisual Demo
The screenshots demonstrate:
Behavior
Automatic RTL Activation:
ar, Hebrewhe)IsSupportRTL=Truetranslation settingManual Control:
Ctrl + Right ShiftCtrl + Left ShiftThis implementation provides seamless RTL support for markdown files, automatically adapting to user's language preferences while maintaining full manual control options, consistent with the existing TextViewer RTL functionality.
Fixes #1705.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.