Skip to content

Fix opening Markdown files directly in the editor on Windows Tauri builds #248

Description

@petertzy

Problem Description

There is an issue with opening Markdown files in the Windows packaged version of the Tauri app.

When a user clicks or double-clicks a .md file in Windows and the file is associated with the app, the app does not correctly open the Markdown file in the editor.

The problem appears to be specific to the packaged Windows build and should be investigated from the perspective of Tauri's Windows file association, application startup arguments, single-instance handling, and file-path/event delivery.

Steps to Reproduce

  1. Install the packaged Tauri app on Windows.
  2. Create or locate a .md Markdown file.
  3. Double-click the .md file in Windows File Explorer.
  4. Open it with the app.
  5. Observe whether the file is loaded into the editor.

Current Behavior

When a .md file is opened from Windows:

  • The app may launch or become active, but the Markdown file is not correctly opened.
  • The file content is not loaded into the editor.
  • The user cannot open the Markdown file directly in the editor by double-clicking it.

Expected Behavior

When a user double-clicks a .md file in Windows:

  1. The Tauri app should launch if it is not already running.
  2. The app should correctly receive the path of the file being opened.
  3. The file path should be passed to the frontend.
  4. The frontend should load the corresponding Markdown file.
  5. The editor should open automatically and display the file contents.

If the app is already running, double-clicking another .md file should send the new file path to the existing app instance and open that file directly in the editor.

Areas to Investigate

1. Tauri File Association

Check the Windows file association configuration in the Tauri packaging setup.

Please verify:

  • .md is correctly registered as a supported file type;
  • Windows correctly associates .md files with the application;
  • Windows actually passes the selected file path to the Tauri application.

2. Windows Startup Arguments

Check how the application receives file paths when launched through Windows file association.

Please verify:

  • The arguments passed to the application on Windows;
  • How Tauri exposes those arguments to the application;
  • Whether the packaged production build behaves differently from development mode;
  • Whether Windows file paths are parsed correctly.

3. Tauri Single-Instance Handling

If the project uses Tauri's single-instance functionality, verify both cases:

  • App is not running when the .md file is opened;
  • App is already running when another .md file is opened.

Please verify that:

  • The file path is received correctly;
  • The existing app instance receives the new file-open request;
  • The existing instance triggers the correct file-opening logic;
  • The second file does not simply activate the app without opening the document.

4. Rust → Frontend / WebView Communication

Please inspect the full file-opening flow:

Windows double-click .md
Tauri receives file path
Rust
Tauri event / IPC
Frontend
Editor
Load Markdown file

Verify that the file path is reliably delivered across the Rust/frontend boundary.

Also check for startup timing issues. For example, the Rust side may emit the file-open event before the frontend listener has been initialized, causing the event to be lost.

5. Windows Path Handling

Test and verify support for:

  • Normal English paths;
  • Paths containing spaces;
  • Paths containing Chinese or other Unicode characters;
  • Paths containing special characters;
  • Deep/nested directory paths.

The full Windows path should remain intact when passed between Tauri, Rust, and the frontend.

6. Development vs. Production Differences

Because the issue appears to occur in the packaged Windows application, compare:

  • tauri dev;
  • Windows production build / installer.

Please check for differences in:

  • File association registration;
  • Startup arguments;
  • Resource paths;
  • App initialization;
  • Single-instance behavior;
  • File-open event handling.

Verification Requirements

After the fix, please verify at least the following:

  1. Double-clicking a .md file when the app is not running launches the app and opens the file in the editor.
  2. Double-clicking another .md file while the app is already running opens the new file in the existing app instance.
  3. Multiple Markdown files can be opened sequentially.
  4. Markdown files in paths containing spaces can be opened correctly.
  5. Markdown files in paths containing Chinese/Unicode characters can be opened correctly.
  6. The packaged Windows production build works correctly.
  7. The opened file can be edited and saved normally.
  8. Existing file-opening behavior on macOS/Linux is not broken by the fix.

Acceptance Criteria

  • Windows packaged Tauri app can open a .md file directly by double-clicking it.
  • The app correctly handles .md files when launched from Windows file association.
  • The app correctly handles new .md open requests when an instance is already running.
  • The Markdown file path is reliably passed from Tauri/Rust to the frontend.
  • The Markdown content is automatically loaded into the editor.
  • Windows paths containing spaces, Unicode characters, and special characters work correctly.
  • The fix works in the packaged production build, not only in development mode.
  • Identify and document the root cause.
  • Add appropriate regression tests to prevent the issue from recurring.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions