Skip to content

Commit 5ff2e9d

Browse files
Alparseclaude
andcommitted
Initial commit: full-featured Markdown editor for Windows
Electron desktop app with CodeMirror 6 editor, live markdown preview, syntax highlighting, formatting toolbar, dark/light themes, TOC sidebar, export to HTML/PDF, .md file association, and auto-update via GitHub Releases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 parents  commit 5ff2e9d

42 files changed

Lines changed: 10009 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
runs-on: windows-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
cache: npm
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Build renderer bundle
27+
run: node esbuild.config.mjs
28+
29+
- name: Build and publish installer
30+
env:
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
CSC_IDENTITY_AUTO_DISCOVERY: false
33+
run: npx electron-builder --win --publish always

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
dist/
3+
release/
4+
src/renderer/dist/
5+
*.map
6+
scripts/
7+
*.log
8+
Thumbs.db

assets/file-icon.ico

2.19 KB
Binary file not shown.

assets/icon.ico

2.19 KB
Binary file not shown.

assets/icon.png

1.59 KB
Loading

electron-builder.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
appId: com.mdeditor.app
2+
productName: "MD Editor"
3+
copyright: "Copyright 2026"
4+
5+
publish:
6+
provider: github
7+
owner: Alparse
8+
repo: md_app
9+
10+
directories:
11+
output: release
12+
buildResources: build
13+
14+
files:
15+
- "src/main/**/*"
16+
- "src/preload/**/*"
17+
- "src/renderer/index.html"
18+
- "src/renderer/dist/**/*"
19+
- "src/renderer/styles/**/*"
20+
- "src/renderer/fonts/**/*"
21+
- "node_modules/**/*"
22+
- "package.json"
23+
24+
fileAssociations:
25+
- ext: md
26+
name: "Markdown Document"
27+
description: "Markdown Document"
28+
role: Editor
29+
- ext: markdown
30+
name: "Markdown Document"
31+
description: "Markdown Document"
32+
role: Editor
33+
34+
win:
35+
target:
36+
- target: portable
37+
arch:
38+
- x64
39+
- target: nsis
40+
arch:
41+
- x64
42+
icon: "assets/icon.ico"
43+
signingHashAlgorithms: []
44+
sign: null
45+
forceCodeSigning: false
46+
47+
nsis:
48+
oneClick: false
49+
perMachine: true
50+
allowToChangeInstallationDirectory: true
51+
createDesktopShortcut: true
52+
createStartMenuShortcut: true
53+
shortcutName: "MD Editor"
54+
runAfterFinish: true

esbuild.config.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { build, context } from 'esbuild';
2+
3+
const isWatch = process.argv.includes('--watch');
4+
5+
const options = {
6+
entryPoints: ['src/renderer/app.js'],
7+
bundle: true,
8+
outfile: 'src/renderer/dist/bundle.js',
9+
format: 'iife',
10+
platform: 'browser',
11+
sourcemap: true,
12+
target: ['chrome128'],
13+
logLevel: 'info',
14+
};
15+
16+
if (isWatch) {
17+
const ctx = await context(options);
18+
await ctx.watch();
19+
console.log('Watching for changes...');
20+
} else {
21+
await build(options);
22+
}

install.bat

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@echo off
2+
echo MD Editor - Installation
3+
echo ========================
4+
echo.
5+
echo This will install MD Editor and associate .md files with it.
6+
echo Right-click this file and select "Run as administrator" for system-wide installation.
7+
echo.
8+
powershell -ExecutionPolicy Bypass -File "%~dp0install.ps1"

install.ps1

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# MD Editor - Windows Install Script
2+
# Run as Administrator: Right-click > Run with PowerShell
3+
# This script creates file associations for .md files
4+
5+
param(
6+
[string]$InstallDir = "$env:LOCALAPPDATA\MD Editor"
7+
)
8+
9+
$ErrorActionPreference = "Stop"
10+
11+
Write-Host "MD Editor - Windows Installation" -ForegroundColor Cyan
12+
Write-Host "=================================" -ForegroundColor Cyan
13+
Write-Host ""
14+
15+
# Check for admin rights (required for HKLM registry and ProgID)
16+
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
17+
18+
# Source directory (where the unpacked app is)
19+
$sourceDir = Join-Path $PSScriptRoot "dist\win-unpacked"
20+
$exeName = "MD Editor.exe"
21+
22+
if (-not (Test-Path (Join-Path $sourceDir $exeName))) {
23+
Write-Host "Error: Could not find '$exeName' in $sourceDir" -ForegroundColor Red
24+
Write-Host "Please run 'npm run pack' first to build the app." -ForegroundColor Yellow
25+
Read-Host "Press Enter to exit"
26+
exit 1
27+
}
28+
29+
# Copy to install directory
30+
Write-Host "Installing to: $InstallDir" -ForegroundColor Green
31+
if (Test-Path $InstallDir) {
32+
Remove-Item $InstallDir -Recurse -Force
33+
}
34+
Copy-Item $sourceDir $InstallDir -Recurse
35+
Write-Host " Files copied." -ForegroundColor Gray
36+
37+
$exePath = Join-Path $InstallDir $exeName
38+
39+
# Create Start Menu shortcut
40+
$startMenuDir = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs"
41+
$shortcutPath = Join-Path $startMenuDir "MD Editor.lnk"
42+
$shell = New-Object -ComObject WScript.Shell
43+
$shortcut = $shell.CreateShortcut($shortcutPath)
44+
$shortcut.TargetPath = $exePath
45+
$shortcut.WorkingDirectory = $InstallDir
46+
$shortcut.Description = "Markdown Editor"
47+
$shortcut.Save()
48+
Write-Host " Start Menu shortcut created." -ForegroundColor Gray
49+
50+
# Create Desktop shortcut
51+
$desktopShortcut = Join-Path ([Environment]::GetFolderPath("Desktop")) "MD Editor.lnk"
52+
$shortcut2 = $shell.CreateShortcut($desktopShortcut)
53+
$shortcut2.TargetPath = $exePath
54+
$shortcut2.WorkingDirectory = $InstallDir
55+
$shortcut2.Description = "Markdown Editor"
56+
$shortcut2.Save()
57+
Write-Host " Desktop shortcut created." -ForegroundColor Gray
58+
59+
# Set up file associations
60+
$regRoot = if ($isAdmin) { "HKLM:" } else { "HKCU:" }
61+
$regPrefix = if ($isAdmin) { "HKEY_LOCAL_MACHINE" } else { "HKEY_CURRENT_USER" }
62+
63+
Write-Host "Setting up .md file association..." -ForegroundColor Green
64+
65+
# Register the application ProgID
66+
$progId = "MDEditor.MarkdownFile"
67+
$progIdPath = "$regRoot\SOFTWARE\Classes\$progId"
68+
New-Item -Path $progIdPath -Force | Out-Null
69+
Set-ItemProperty -Path $progIdPath -Name "(Default)" -Value "Markdown Document"
70+
71+
# Set icon
72+
$iconPath = "$progIdPath\DefaultIcon"
73+
New-Item -Path $iconPath -Force | Out-Null
74+
Set-ItemProperty -Path $iconPath -Name "(Default)" -Value "`"$exePath`",0"
75+
76+
# Set open command
77+
$commandPath = "$progIdPath\shell\open\command"
78+
New-Item -Path $commandPath -Force | Out-Null
79+
Set-ItemProperty -Path $commandPath -Name "(Default)" -Value "`"$exePath`" `"%1`""
80+
81+
# Associate .md extension
82+
$extPath = "$regRoot\SOFTWARE\Classes\.md"
83+
New-Item -Path $extPath -Force | Out-Null
84+
Set-ItemProperty -Path $extPath -Name "(Default)" -Value $progId
85+
86+
# Associate .markdown extension
87+
$extPath2 = "$regRoot\SOFTWARE\Classes\.markdown"
88+
New-Item -Path $extPath2 -Force | Out-Null
89+
Set-ItemProperty -Path $extPath2 -Name "(Default)" -Value $progId
90+
91+
Write-Host " .md and .markdown files associated with MD Editor." -ForegroundColor Gray
92+
93+
# Notify Windows of the change
94+
$code = @"
95+
[System.Runtime.InteropServices.DllImport("shell32.dll")]
96+
public static extern void SHChangeNotify(int wEventId, int uFlags, System.IntPtr dwItem1, System.IntPtr dwItem2);
97+
"@
98+
$type = Add-Type -MemberDefinition $code -Name "ShellNotify" -Namespace "Win32" -PassThru
99+
$type::SHChangeNotify(0x08000000, 0, [System.IntPtr]::Zero, [System.IntPtr]::Zero)
100+
101+
Write-Host ""
102+
Write-Host "Installation complete!" -ForegroundColor Green
103+
Write-Host ""
104+
Write-Host "You can now:" -ForegroundColor Cyan
105+
Write-Host " - Double-click any .md file to open it in MD Editor"
106+
Write-Host " - Launch from Start Menu or Desktop shortcut"
107+
Write-Host " - Run from: $exePath"
108+
Write-Host ""
109+
110+
if (-not $isAdmin) {
111+
Write-Host "Note: Run as Administrator for system-wide file association." -ForegroundColor Yellow
112+
Write-Host "Current installation is per-user only." -ForegroundColor Yellow
113+
}
114+
115+
Read-Host "Press Enter to exit"

0 commit comments

Comments
 (0)