Skip to content

Desktop App

Baivab Sarkar edited this page Jul 14, 2026 · 3 revisions

Desktop Markdown Editor App

The desktop app wraps Markdown Viewer in Neutralinojs for users who want a lightweight local Markdown editor and viewer window. It uses the same editor, preview, renderer, sharing, and export code as the web app, with native file dialogs and local desktop storage.

What Is Different From The Web App?

  • Runs in a Neutralinojs desktop window.
  • Uses native open/save dialogs for Markdown and HTML.
  • Can read a Markdown file path passed as a launch argument.
  • Asks for confirmation before closing.
  • Mirrors selected localStorage values into Neutralino storage for restart persistence.
  • Uses a restricted native API allowlist.
  • Prepared builds load renderer libraries from local /libs/... files instead of CDNs.
  • The default configuration does not expose os.execCommand; Markdown preview cannot execute local shell commands through the standard desktop build.

Network features remain network features: GitHub import, stored Share Snapshot, Live Share, remote diagram rendering, external images, and external links can still contact remote services.

Directory Structure

desktop-app/
  neutralino.config.json
  package.json
  setup-binaries.js
  prepare.js
  resources/
    index.html
    styles.css
    js/
      main.js
      script.js
      preview-worker.js
      neutralino.js
    libs/
    assets/

prepare.js recreates the resource files from the root web app. Do not hand-edit generated resource copies unless you plan to rerun preparation.

Development

cd desktop-app
npm install
npm run setup
npm run dev

npm run setup downloads Neutralino binaries and runs prepare.js. Development runs the Neutralino app through npx -y @neutralinojs/neu@11.7.0 run.

Build

npm run build

The current package script runs Neutralino release build with --clean and removes dist/markdown-viewer-release.zip if it exists. Generated files appear under desktop-app/dist/.

Runtime Configuration

Important neutralino.config.json values:

Setting Current Value
Application id com.markdownviewer.desktop
Document root /resources/
Default mode window
Window size 1280 x 720
Minimum size 400 x 200
Native API Enabled
Token security One-time
Logging Disabled

Allowed native APIs:

  • app.exit
  • os.showOpenDialog
  • os.showSaveDialog
  • os.showMessageBox
  • os.open
  • os.setTray
  • filesystem.readFile
  • filesystem.writeFile
  • storage.setData
  • storage.getData

os.execCommand is intentionally absent from the default allowlist. A custom build that adds local command execution must treat document content as untrusted and use an explicit opt-in with fixed, narrowly scoped commands.

Browser/chrome modes block filesystem and OS APIs more tightly.

Desktop Preparation

prepare.js:

  • Copies the root app into desktop-app/resources.
  • Copies assets.
  • Moves runtime scripts to the desktop resource structure.
  • Rewrites library URLs for Neutralino.
  • Downloads required external libraries to resources/libs.
  • Verifies SHA-384 integrity when SRI hashes are available.
  • Bundles Bootstrap icon fonts.
  • Strips web-only SEO/canonical/hreflang/schema metadata from the desktop HTML.

This is why the prepared desktop app can load core bundled renderer libraries without CDNs after setup.

Platform Notes

Windows may show SmartScreen warnings because binaries are unsigned.

Linux:

chmod +x markdown-viewer-linux_x64
./markdown-viewer-linux_x64

macOS:

xattr -d com.apple.quarantine markdown-viewer-mac_universal
chmod +x markdown-viewer-mac_universal
./markdown-viewer-mac_universal

Data Handling

  • Normal documents and settings are local to the machine.
  • Native file access happens through explicit open/save actions or launch arguments.
  • The app does not include analytics or telemetry.
  • Sharing/import/remote-rendering features use the same network behavior as the web app.

Clone this wiki locally