<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zhanibek Nugmanov</title>
    <description>The latest articles on DEV Community by Zhanibek Nugmanov (@zhanibek_nugmanov_bbfccbd).</description>
    <link>https://dev.to/zhanibek_nugmanov_bbfccbd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3173209%2Fcce2c716-8f59-4588-8420-cc20219ea0e7.png</url>
      <title>DEV Community: Zhanibek Nugmanov</title>
      <link>https://dev.to/zhanibek_nugmanov_bbfccbd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zhanibek_nugmanov_bbfccbd"/>
    <language>en</language>
    <item>
      <title>How I Rendered Mermaid &amp; Math Markdown in Windows Explorer in 0.86s (No PowerToys, No Admin)</title>
      <dc:creator>Zhanibek Nugmanov</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:56:44 +0000</pubDate>
      <link>https://dev.to/zhanibek_nugmanov_bbfccbd/how-i-rendered-mermaid-math-markdown-in-windows-explorer-in-086s-no-powertoys-no-admin-2g8d</link>
      <guid>https://dev.to/zhanibek_nugmanov_bbfccbd/how-i-rendered-mermaid-math-markdown-in-windows-explorer-in-086s-no-powertoys-no-admin-2g8d</guid>
      <description>&lt;p&gt;With AI coding agents generating PRDs, architecture specs, skills, and design notes all day, my folders are full of &lt;code&gt;.md&lt;/code&gt; files with Mermaid diagrams and math formulas.&lt;/p&gt;

&lt;p&gt;I just wanted to click a &lt;code&gt;.md&lt;/code&gt; file in Windows Explorer, press &lt;strong&gt;Alt+P&lt;/strong&gt;, and &lt;em&gt;see it rendered&lt;/em&gt; — without opening VS Code every time or installing all of PowerToys. Microsoft PowerToys previews Markdown in Explorer, &lt;strong&gt;but it skips Mermaid diagrams and math&lt;/strong&gt; (and blocks images by default).&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;&lt;a href="https://github.com/Zhanibek55/md-preview" rel="noopener noreferrer"&gt;MdPreview&lt;/a&gt;&lt;/strong&gt; — a free, open-source (MIT), fully offline Windows Explorer preview handler that installs &lt;strong&gt;per-user with no admin rights&lt;/strong&gt; and renders diagrams in under a second.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyrpdrpqpoikhg3952ffj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyrpdrpqpoikhg3952ffj.png" alt="MdPreview rendering Markdown and diagrams in Windows Explorer" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's what it does and the 3 non-obvious Windows + WebView2 lessons that made it fast and safe.&lt;/p&gt;




&lt;h2&gt;
  
  
  What It Renders (100% Offline)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mermaid diagrams&lt;/strong&gt; (flowcharts, sequence diagrams, etc.) and &lt;strong&gt;KaTeX math&lt;/strong&gt; (&lt;code&gt;$...$&lt;/code&gt; / &lt;code&gt;$$...$$&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Syntax-highlighted code&lt;/strong&gt; via &lt;code&gt;highlight.js&lt;/code&gt; with auto-detection when no language tag is specified + Copy button&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub-flavored Markdown&lt;/strong&gt;: tables, task lists, &lt;code&gt;&amp;gt; [!NOTE]&lt;/code&gt; / &lt;code&gt;[!WARNING]&lt;/code&gt; alerts, footnotes, emoji shortcodes (&lt;code&gt;:rocket:&lt;/code&gt; → 🚀), collapsible YAML front matter&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Navigation&lt;/strong&gt;: floating headings &lt;strong&gt;outline&lt;/strong&gt; with scroll-spy, working in-document TOC links, and &lt;strong&gt;Ctrl+F&lt;/strong&gt; find-in-page (via the CSS Custom Highlight API)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Light / dark theme&lt;/strong&gt; following Windows automatically&lt;/li&gt;
&lt;li&gt;Bonus: because it uses the standard Windows &lt;code&gt;IPreviewHandler&lt;/code&gt; interface, it also renders &lt;code&gt;.md&lt;/code&gt; attachments in &lt;strong&gt;classic desktop Outlook&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5ih8eca4huo5vpu49v57.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5ih8eca4huo5vpu49v57.png" alt="Dark theme with outline, syntax highlighting, and blocked remote image placeholder" width="800" height="727"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  3 Engineering Lessons Along the Way
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Why rewriting in Rust wouldn't have fixed the 9.9s cold start
&lt;/h3&gt;

&lt;p&gt;Early on, the first Mermaid diagram took &lt;strong&gt;9.9 seconds&lt;/strong&gt; to render on a cold start. My first instinct was: &lt;em&gt;"Is .NET or the Markdown parser slow? Should I rewrite this in Rust?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Profiling proved that instinct completely wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Markdig&lt;/strong&gt; parsed a real 27 KB PRD in &lt;strong&gt;2.7 ms&lt;/strong&gt; (and a 784 KB file in 65 ms).&lt;/li&gt;
&lt;li&gt;Almost the entire 9.9 seconds was Chromium booting and &lt;strong&gt;compiling Mermaid's 5.5 MB JavaScript bundle from scratch&lt;/strong&gt; — because I had served all virtual assets with &lt;code&gt;Cache-Control: no-store&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rewriting the host in Rust would still run WebView2 and still compile the exact same 5.5 MB JS bundle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The actual fix was V8 bytecode caching:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Serve the immutable bundled libraries (Mermaid, KaTeX, highlight.js) with cacheable headers + &lt;code&gt;ETag&lt;/code&gt; while keeping the HTML document itself &lt;code&gt;no-store&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run a silent 2-pass off-screen warm-up during install (&lt;code&gt;Warmup.exe&lt;/code&gt;), because Chromium persists V8 bytecode to its on-disk &lt;strong&gt;Code Cache&lt;/strong&gt; (~1.5 MB) on a script's &lt;em&gt;second&lt;/em&gt; execution.&lt;/li&gt;
&lt;li&gt;Start the WebView2 environment in parallel while Markdig parses the file.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Measured result (Windows 11, i9-13900H, WebView2 157):&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;First diagram render after install&lt;/td&gt;
&lt;td&gt;9.9 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.86 s&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cold &lt;code&gt;prevhost.exe&lt;/code&gt; (after browser exit / reboot)&lt;/td&gt;
&lt;td&gt;9.9 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.5 – 0.75 s&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Next file in the same pane (warm)&lt;/td&gt;
&lt;td&gt;0.25 – 0.7 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.1 – 0.5 s&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;On-disk V8 Code Cache&lt;/td&gt;
&lt;td&gt;3 KB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~1.5 MB (persisted)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  2. &lt;code&gt;prevhost.exe&lt;/code&gt; ignores your HKCU integrity hints
&lt;/h3&gt;

&lt;p&gt;Windows Explorer loads COM preview handlers (&lt;code&gt;IPreviewHandler&lt;/code&gt; / &lt;code&gt;IInitializeWithFile&lt;/code&gt;) into &lt;code&gt;prevhost.exe&lt;/code&gt; at &lt;strong&gt;Low Integrity Level&lt;/strong&gt; — even if you set &lt;code&gt;DisableLowILProcessIsolation&lt;/code&gt; under &lt;code&gt;HKCU&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If your handler tries to put its WebView2 user-data directory or logs inside &lt;code&gt;%LOCALAPPDATA%&lt;/code&gt;, WebView2 silently fails to initialize in Explorer while passing all your standalone harness tests. Moving the WebView2 profile and log folder to &lt;code&gt;%USERPROFILE%\AppData\LocalLow\MdPreview&lt;/code&gt; solved it cleanly — while keeping the entire installation per-user under &lt;code&gt;HKCU&lt;/code&gt; and &lt;code&gt;%LOCALAPPDATA%\Programs\MdPreview&lt;/code&gt; with &lt;strong&gt;zero administrator rights&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Strict offline CSP by default
&lt;/h3&gt;

&lt;p&gt;Previewing random &lt;code&gt;.md&lt;/code&gt; files shouldn't leak your IP or execute scripts. MdPreview serves the HTML page, bundled JS/CSS, and local images strictly from memory over a synthetic local origin (&lt;code&gt;https://mdpreview.example/&lt;/code&gt;) with a strict Content-Security-Policy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zero network access by default&lt;/li&gt;
&lt;li&gt;Scripts, iframes, and auto-redirects in hostile &lt;code&gt;.md&lt;/code&gt; files never execute&lt;/li&gt;
&lt;li&gt;Remote images are blocked and replaced with a clean placeholder (opt-in toggle included if you want them)&lt;/li&gt;
&lt;li&gt;External links open in your default browser only on an explicit click&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Try It (Per-User, No Admin)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;One-liner in PowerShell&lt;/strong&gt; (inspect &lt;a href="https://github.com/Zhanibek55/md-preview/blob/main/install-online.ps1" rel="noopener noreferrer"&gt;install-online.ps1&lt;/a&gt; first if you prefer):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;irm&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;githubusercontent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nc"&gt;Zhanibek55&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;md&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;preview&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;online&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ps1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;iex&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Via Scoop:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;scoop&lt;/span&gt; &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt; &lt;span class="n"&gt;md&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;preview&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nc"&gt;Zhanibek55&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;md&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;preview&lt;/span&gt;
&lt;span class="n"&gt;scoop&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;md&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;preview&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Or manually:&lt;/strong&gt; grab &lt;code&gt;MdPreview-0.1.0.0.zip&lt;/code&gt; (~4.4 MB) from &lt;a href="https://github.com/Zhanibek55/md-preview/releases" rel="noopener noreferrer"&gt;GitHub Releases&lt;/a&gt;, unzip, and run &lt;code&gt;Install.cmd&lt;/code&gt;. Then select any &lt;code&gt;.md&lt;/code&gt; file in Explorer and hit &lt;strong&gt;Alt+P&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub (MIT):&lt;/strong&gt; &lt;a href="https://github.com/Zhanibek55/md-preview" rel="noopener noreferrer"&gt;https://github.com/Zhanibek55/md-preview&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optional download / tip jar (pay-what-you-want, $0+):&lt;/strong&gt; &lt;a href="https://payhip.com/b/yNw8e" rel="noopener noreferrer"&gt;https://payhip.com/b/yNw8e&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What Should Explorer Preview Next?
&lt;/h2&gt;

&lt;p&gt;Now that the &lt;code&gt;IPreviewHandler&lt;/code&gt; + cached WebView2 pipeline works reliably offline, extending it to other developer and data formats is straightforward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which file types do you wish Windows Explorer rendered natively in the preview pane?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.parquet&lt;/code&gt; (schema + table preview + column stats)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.ipynb&lt;/code&gt; (rendered Jupyter notebooks with charts, instead of raw JSON)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.csv&lt;/code&gt; / &lt;code&gt;.tsv&lt;/code&gt; (fast table view without launching Excel)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.json&lt;/code&gt; / &lt;code&gt;.yaml&lt;/code&gt; (collapsible tree + Ctrl+F)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Drop a comment — I'm genuinely curious which one hurts the most in your daily workflow!&lt;/p&gt;

</description>
      <category>windows</category>
      <category>opensource</category>
      <category>markdown</category>
      <category>dotnet</category>
    </item>
  </channel>
</rss>
