Skip to content

[Port]: PreviewMD on Windows #22

Open

Description

Target platform

Windows 11 (works on Windows 10 22H2+ too)

Proposed native stack and embedded web view

WinUI 3 (C#/.NET 8) + WebView2

First vertical slice

One WinUI 3 window that opens a local Markdown file and renders it fully offline. It reuses the renderer from Sources/PreviewMD/Resources/Renderer/ unchanged.

  1. Offline rendering. The build script copies the Renderer folder into the MSIX package and verifies it by checksum. WebView2 loads it through SetVirtualHostNameToFolderMapping. markdown-it, Mermaid, KaTeX and highlight.js all come from the package, nothing from the network.
  2. Open a local file. A FileOpenPicker filtered to .md/.markdown. The shell reads the file and passes the content plus its folder path to the renderer, following the "load Markdown" contract from docs/PORTING.md. With no file open, the window shows an empty state with an Open button.
  3. Relative images. The shell serves files only from the opened document's folder, so ![alt](img/pic.png) resolves offline and nothing outside that folder is readable.
  4. One bridge action. Clicking an external link opens it in the default browser via Launcher.LaunchUriAsync. Local links stay in the document.

Done means: open a .md file, it renders offline with diagrams, math and code highlighting, a relative image shows up, an external link opens in the browser.

How will this feel native to the platform?

  • WinUI 3 window with the standard Windows title bar, snap layouts, Ctrl+O/Ctrl+W/Ctrl+Tab shortcuts and native context menus. Tabs in a TabView come after the slice works.
  • Follows the Windows dark/light theme.
  • Native file dialogs, drag and drop of .md files onto the window, recent files in the Jump List.
  • MSIX package. Per docs/PORTING.md I won't copy the macOS toolbar. Windows gets Windows patterns.

Files, sandboxing, links, and updates

  • The renderer runs in WebView2's sandboxed Chromium processes. The only privileged part is the C# bridge with three operations: load document, resolve resource, open link.
  • MSIX packages are read-only, so the bundled renderer assets can't change at runtime. The build pins them by checksum. The app makes no network requests.
  • File access goes through the picker, so the user chooses what to open. The resource resolver only touches the opened document's folder. External links always go out to the default browser and never render inside the app.
  • Updates: dev-signed MSIX for the prototype. Store or sideload distribution only if the port matures, and per TRADEMARKS.md.

Maintenance plan

I'm @kamilkaczmareksolutions, working on Windows, no Mac involved. This starts as a proof of concept: I'll build the slice and iterate through review. If the project develops well, I'm open to staying on as the Windows maintainer. If not, I'll leave the experiment documented and easy for someone else to pick up.

Before submitting

  • I read docs/PORTING.md and will begin with a thin experiment rather than rewriting the macOS app.
  • I understand that public use of the PreviewMD name and icon follows TRADEMARKS.md.

Activity

  1. kamilkaczmareksolutions commented on Aug 13, 2026

    @kamilkaczmareksolutions
    Author

    Status update: I started the thin slice on my fork (kamilkaczmareksolutions/PreviewMD). One deviation from the proposal above: the prototype shell is Tauri 2 (Rust) instead of WinUI 3. Tauri on Windows embeds the same system WebView2, but it needs no .NET SDK and keeps the experiment small and reviewable. The bridge mirrors the macOS contract 1:1: previewmdRender / previewmdSetLayout going in, the copyText / editorChange / pickImage style messages coming out, and a previewmd-local-image custom scheme for relative images, all offline. WinUI 3 remains an option for a fully native chrome if this experiment graduates.

  2. kamilkaczmareksolutions commented on Oct 4, 2026

    @kamilkaczmareksolutions
    Author

    The slice from this issue is in #28.

    That pull request is the WinUI 3 window. It opens a local Markdown file and renders diagrams, math, and highlighted code offline. A relative image stays in the document folder. An external link opens in the browser. The same pull request has the file picker, a drop from Explorer, Ctrl+O, Ctrl+W, and the taskbar Recent list.

    Tabs and Ctrl+Tab stay out. This issue leaves a TabView until after the slice works.

    Merging #28 resolves this issue.

  3. ashtree74 commented on Oct 6, 2026

    @ashtree74
    Owner

    The Windows implementation is tracked in #28. The macOS PreviewMD 1.8 (12) release from #29 does not include this port.

    I have recorded an initial source review on #28. Remaining work includes syncing the pinned renderer with current main, making checksum verification independent of checkout line-ending differences, addressing the resource-confinement limitation already documented by the port, and rerunning Windows build/tests plus MSIX installation/launch checks. The README also needs to match the implemented drag/drop and Jump List behavior.

    Keeping this proposal open while #28 is revised and validated on Windows. It should be resolved when that slice is merged, rather than closed as part of the macOS release cleanup. Thank you for building and testing the native Windows experiment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions