diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs index 3a39eef..f262a6c 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs @@ -25,7 +25,7 @@ namespace QuickLook.Plugin.ArchiveViewer; public class Plugin : IViewer { - private static readonly string[] Extensions = + private static readonly string[] _extensions = [ ".7z", ".bz2", @@ -50,7 +50,7 @@ public class Plugin : IViewer public bool CanHandle(string path) { - return !Directory.Exists(path) && Extensions.Any(path.ToLower().EndsWith); + return !Directory.Exists(path) && _extensions.Any(path.ToLower().EndsWith); } public void Prepare(string path, ContextObject context) diff --git a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Plugin.cs index 89daca2..11ca6fd 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Plugin.cs @@ -25,8 +25,8 @@ namespace QuickLook.Plugin.HtmlViewer; public class Plugin : IViewer { - private static readonly string[] Extensions = [".mht", ".mhtml", ".htm", ".html"]; - private static readonly string[] SupportedProtocols = ["http", "https"]; + private static readonly string[] _extensions = [".mht", ".mhtml", ".htm", ".html"]; + private static readonly string[] _supportedProtocols = ["http", "https"]; private WebpagePanel _panel; @@ -38,9 +38,9 @@ public class Plugin : IViewer public bool CanHandle(string path) { - return !Directory.Exists(path) && (Extensions.Any(path.ToLower().EndsWith) || + return !Directory.Exists(path) && (_extensions.Any(path.ToLower().EndsWith) || path.ToLower().EndsWith(".url") && - SupportedProtocols.Contains(Helper.GetUrlPath(path).Split(':')[0] + _supportedProtocols.Contains(Helper.GetUrlPath(path).Split(':')[0] .ToLower())); } diff --git a/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Plugin.cs index 07dcd2e..2b13f52 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Plugin.cs @@ -34,6 +34,23 @@ public class Plugin : IViewer private WebpagePanel? _panel; private string? _currentHtmlPath; + /// + /// Markdown and Markdown-like extensions + /// It is not guaranteed to support all formats perfectly + /// + private static readonly string[] _extensions = + [ + ".md", ".markdown", // The most common Markdown extensions + ".mdx", // MDX (Markdown + JSX), used in React ecosystems + ".mmd", // MultiMarkdown (MMD), an extended version of Markdown + ".mkd", ".mdwn", ".mdown", // Early Markdown variants, used by different parsers like Pandoc, Gitit, and Hakyll + ".mdc", // A Markdown variant used by Cursor AI [Repeated format from ImageViewer] + ".qmd", // Quarto Markdown, developed by RStudio for scientific computing and reproducible reports + ".rmd", ".rmarkdown", // R Markdown, mainly used in RStudio + ".apib", // API Blueprint, a Markdown-based format + ".mdtxt", ".mdtext", // Less common + ]; + private static readonly string _resourcePath = Path.Combine(SettingHelper.LocalDataPath, "QuickLook.Plugin.MarkdownViewer"); private static readonly string _resourcePrefix = "QuickLook.Plugin.MarkdownViewer.Resources."; private static readonly ResourceManager _resourceManager = new(_resourcePath, _resourcePrefix); @@ -51,7 +68,7 @@ public class Plugin : IViewer public bool CanHandle(string path) { - return !Directory.Exists(path) && new[] { ".md", ".mdown", ".rmd", ".markdown" }.Any(path.ToLower().EndsWith); + return !Directory.Exists(path) && _extensions.Any(path.ToLower().EndsWith); } public void Prepare(string path, ContextObject context) diff --git a/QuickLook.Plugin/QuickLook.Plugin.PEViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.PEViewer/Plugin.cs index d9350c8..2ae2901 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.PEViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.PEViewer/Plugin.cs @@ -25,7 +25,7 @@ namespace QuickLook.Plugin.PEViewer; public class Plugin : IViewer { - private static readonly string[] Extensions = + private static readonly string[] _extensions = [ ".exe", ".sys", ".scr", ".ocx", ".cpl", ".bpl", ".dll", ".ax", ".drv", ".vxd", @@ -46,7 +46,7 @@ public class Plugin : IViewer public bool CanHandle(string path) { - return !Directory.Exists(path) && Extensions.Any(path.ToLower().EndsWith); + return !Directory.Exists(path) && _extensions.Any(path.ToLower().EndsWith); } public void Prepare(string path, ContextObject context)