regen.mde 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +295 -0
  3. package/bin/build-corpus-editor.js +81 -0
  4. package/bin/build-corpus.js +41 -0
  5. package/bin/postinstall.js +187 -0
  6. package/bin/regen-mdeditor-install.js +27 -0
  7. package/bin/regen-mdeditor-uninstall.js +19 -0
  8. package/bin/validate-katex.js +93 -0
  9. package/desktop/BuildCorpusEditor/BuildCorpusBridge.cs +270 -0
  10. package/desktop/BuildCorpusEditor/BuildCorpusEditor.csproj +22 -0
  11. package/desktop/BuildCorpusEditor/EditorForm.cs +540 -0
  12. package/desktop/BuildCorpusEditor/Program.cs +81 -0
  13. package/desktop/BuildCorpusEditor/app.manifest +16 -0
  14. package/dist/release/regen.mde-0.2.2-win-x64-setup.exe +0 -0
  15. package/dist/release/regen.mde-0.2.2-win-x64.zip +0 -0
  16. package/dist/windows-editor/BuildCorpusEditor.deps.json +83 -0
  17. package/dist/windows-editor/BuildCorpusEditor.dll +0 -0
  18. package/dist/windows-editor/BuildCorpusEditor.exe +0 -0
  19. package/dist/windows-editor/BuildCorpusEditor.pdb +0 -0
  20. package/dist/windows-editor/BuildCorpusEditor.runtimeconfig.json +19 -0
  21. package/dist/windows-editor/Microsoft.Web.WebView2.Core.dll +0 -0
  22. package/dist/windows-editor/Microsoft.Web.WebView2.Core.xml +6817 -0
  23. package/dist/windows-editor/Microsoft.Web.WebView2.WinForms.dll +0 -0
  24. package/dist/windows-editor/Microsoft.Web.WebView2.WinForms.xml +510 -0
  25. package/dist/windows-editor/Microsoft.Web.WebView2.Wpf.dll +0 -0
  26. package/dist/windows-editor/Microsoft.Web.WebView2.Wpf.xml +1902 -0
  27. package/dist/windows-editor/WebView2Loader.dll +0 -0
  28. package/dist/windows-editor/runtimes/win-x64/native/WebView2Loader.dll +0 -0
  29. package/dist/windows-editor/wwwroot/assets/index-DjJ6xmhy.js +326 -0
  30. package/dist/windows-editor/wwwroot/assets/index-_dwMNNsm.css +1 -0
  31. package/dist/windows-editor/wwwroot/index.html +22 -0
  32. package/editor-web/index.html +21 -0
  33. package/editor-web/src/main.jsx +399 -0
  34. package/editor-web/src/styles.css +602 -0
  35. package/editor-web/vite.config.js +13 -0
  36. package/examples/build-corpus.config.example.json +21 -0
  37. package/installer/install-regen-mde.ps1 +175 -0
  38. package/installer/regen-mde.nsi +81 -0
  39. package/package.json +86 -0
  40. package/pyproject.toml +33 -0
  41. package/requirements.txt +4 -0
  42. package/scripts/build-windows-editor.ps1 +47 -0
  43. package/scripts/package-windows-editor.ps1 +90 -0
  44. package/scripts/run-corpus.ps1 +28 -0
  45. package/scripts/run-editor-implementation-plane.ps1 +203 -0
  46. package/scripts/run-required-tests.ps1 +98 -0
  47. package/scripts/run-smoke.ps1 +28 -0
  48. package/src/build_corpus/__init__.py +3 -0
  49. package/src/build_corpus/docx_exporter.py +798 -0
  50. package/src/build_corpus/exporter.py +1195 -0
  51. package/src/build_corpus/ppt_exporter.py +532 -0
  52. package/src/build_corpus/templates/__init__.py +1 -0
  53. package/src/build_corpus/templates/md-to-word-template.dotx +0 -0
  54. package/src/build_corpus/validate_assets.py +46 -0
  55. package/tools/audit_corpus.py +203 -0
  56. package/tools/collect_microsoft_word_templates.py +228 -0
  57. package/tools/collect_online_docx_corpus.py +272 -0
  58. package/tools/collect_online_pptx_corpus.py +252 -0
  59. package/tools/compare_pptx_inputs_outputs.py +87 -0
  60. package/tools/roundtrip_docx_corpus.py +171 -0
@@ -0,0 +1,175 @@
1
+ [CmdletBinding()]
2
+ param(
3
+ [string]$PackageRoot = "",
4
+ [string]$InstallDir = "$env:LOCALAPPDATA\Programs\regen.mde"
5
+ )
6
+
7
+ $ErrorActionPreference = "Stop"
8
+
9
+ if ([string]::IsNullOrWhiteSpace($PackageRoot)) {
10
+ $PackageApp = Join-Path $PSScriptRoot "app"
11
+ if (Test-Path -LiteralPath (Join-Path $PackageApp "BuildCorpusEditor.exe")) {
12
+ $PackageRoot = $PackageApp
13
+ } else {
14
+ $PackageRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
15
+ }
16
+ }
17
+
18
+ $ProductName = "regen.mde"
19
+ $LegacyProductNames = @("Manuscript Forge", "Regen.MDeditor")
20
+ $AppSource = if (Test-Path -LiteralPath (Join-Path $PackageRoot "BuildCorpusEditor.exe")) {
21
+ $PackageRoot
22
+ } else {
23
+ Join-Path $PackageRoot "dist\windows-editor"
24
+ }
25
+ $AppExe = Join-Path $AppSource "BuildCorpusEditor.exe"
26
+ $StartMenuDir = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\LIFE AI"
27
+ $ShortcutPath = Join-Path $StartMenuDir "$ProductName.lnk"
28
+ $UninstallShortcutPath = Join-Path $StartMenuDir "Uninstall $ProductName.lnk"
29
+ $LegacyInstallDir = Join-Path $env:LOCALAPPDATA "Programs\Manuscript Forge"
30
+ $LegacyInstallDir2 = Join-Path $env:LOCALAPPDATA "Programs\Regen.MDeditor"
31
+
32
+ if (-not (Test-Path -LiteralPath $AppExe)) {
33
+ throw "Package is missing BuildCorpusEditor.exe"
34
+ }
35
+
36
+ function Remove-FileVerb {
37
+ param(
38
+ [string]$Extension,
39
+ [string]$Verb
40
+ )
41
+ Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb" -Recurse -Force -ErrorAction SilentlyContinue
42
+ }
43
+
44
+ Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
45
+ foreach ($legacyProductName in $LegacyProductNames) {
46
+ Remove-Item -LiteralPath (Join-Path $StartMenuDir "$legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
47
+ Remove-Item -LiteralPath (Join-Path $StartMenuDir "Uninstall $legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
48
+ }
49
+ Remove-Item -LiteralPath $ShortcutPath -Force -ErrorAction SilentlyContinue
50
+ Remove-Item -LiteralPath $UninstallShortcutPath -Force -ErrorAction SilentlyContinue
51
+ foreach ($ext in @(".md", ".docx")) {
52
+ foreach ($verb in @("ManuscriptForgeOpen", "BuildCorpusOpenEditor", "RegenMDEditorOpen")) {
53
+ Remove-FileVerb -Extension $ext -Verb $verb
54
+ }
55
+ }
56
+ if ((Test-Path -LiteralPath $LegacyInstallDir) -and ($LegacyInstallDir -ne $InstallDir)) {
57
+ Remove-Item -LiteralPath $LegacyInstallDir -Recurse -Force -ErrorAction SilentlyContinue
58
+ }
59
+ if ((Test-Path -LiteralPath $LegacyInstallDir2) -and ($LegacyInstallDir2 -ne $InstallDir)) {
60
+ Remove-Item -LiteralPath $LegacyInstallDir2 -Recurse -Force -ErrorAction SilentlyContinue
61
+ }
62
+
63
+ New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
64
+ Copy-Item -Path (Join-Path $AppSource "*") -Destination $InstallDir -Recurse -Force
65
+ foreach ($item in @("bin", "src")) {
66
+ $sourcePath = Join-Path $PackageRoot $item
67
+ if (Test-Path -LiteralPath $sourcePath) {
68
+ Copy-Item -LiteralPath $sourcePath -Destination (Join-Path $InstallDir $item) -Recurse -Force
69
+ }
70
+ }
71
+ foreach ($item in @("requirements.txt", "pyproject.toml", "package.json", "package-lock.json")) {
72
+ $sourcePath = Join-Path $PackageRoot $item
73
+ if (Test-Path -LiteralPath $sourcePath) {
74
+ Copy-Item -LiteralPath $sourcePath -Destination $InstallDir -Force
75
+ }
76
+ }
77
+
78
+ $InstalledExe = Join-Path $InstallDir "BuildCorpusEditor.exe"
79
+ $UninstallScript = Join-Path $InstallDir "uninstall-regen-mde.ps1"
80
+
81
+ if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
82
+ throw "Node.js is required on PATH for DOCX/Markdown conversion."
83
+ }
84
+
85
+ $requirements = Join-Path $InstallDir "requirements.txt"
86
+ $pythonReady = $false
87
+ foreach ($candidate in @("py", "python")) {
88
+ if (-not (Get-Command $candidate -ErrorAction SilentlyContinue)) { continue }
89
+ if ($candidate -eq "py") {
90
+ & py -3 -c "import omml2latex, boto3, PIL, docx" 2>$null
91
+ } else {
92
+ & python -c "import omml2latex, boto3, PIL, docx" 2>$null
93
+ }
94
+ if ($LASTEXITCODE -eq 0) {
95
+ $pythonReady = $true
96
+ break
97
+ }
98
+ }
99
+
100
+ if (-not $pythonReady) {
101
+ Write-Warning "Python conversion dependencies are not already installed. Install them later with: py -3 -m pip install -r `"$requirements`""
102
+ }
103
+
104
+ New-Item -ItemType Directory -Force -Path $StartMenuDir | Out-Null
105
+ $shell = New-Object -ComObject WScript.Shell
106
+ $shortcut = $shell.CreateShortcut($ShortcutPath)
107
+ $shortcut.TargetPath = $InstalledExe
108
+ $shortcut.WorkingDirectory = $InstallDir
109
+ $shortcut.IconLocation = "$InstalledExe,0"
110
+ $shortcut.Description = "$ProductName Word and Markdown editor"
111
+ $shortcut.Save()
112
+
113
+ function Set-FileVerb {
114
+ param(
115
+ [string]$Extension,
116
+ [string]$Verb,
117
+ [string]$Label,
118
+ [string]$Command
119
+ )
120
+ $key = "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb"
121
+ $commandKey = Join-Path $key "command"
122
+ New-Item -Path $commandKey -Force | Out-Null
123
+ New-ItemProperty -Path $key -Name "MUIVerb" -Value $Label -PropertyType String -Force | Out-Null
124
+ New-ItemProperty -Path $key -Name "Icon" -Value $InstalledExe -PropertyType ExpandString -Force | Out-Null
125
+ [Microsoft.Win32.Registry]::SetValue(
126
+ "HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb\command",
127
+ "",
128
+ $Command,
129
+ [Microsoft.Win32.RegistryValueKind]::String)
130
+ }
131
+
132
+ Set-FileVerb -Extension ".md" -Verb "RegenMDEditorOpen" -Label "Open in regen.mde" -Command "`"$InstalledExe`" `"%1`""
133
+ Set-FileVerb -Extension ".docx" -Verb "RegenMDEditorOpen" -Label "Open in regen.mde" -Command "`"$InstalledExe`" `"%1`""
134
+
135
+ $uninstall = @"
136
+ `$ErrorActionPreference = "Stop"
137
+ `$ProductName = "regen.mde"
138
+ `$InstallDir = Split-Path -Parent `$MyInvocation.MyCommand.Path
139
+ `$StartMenuDir = Join-Path `$env:APPDATA "Microsoft\Windows\Start Menu\Programs\LIFE AI"
140
+ Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
141
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "`$ProductName.lnk") -Force -ErrorAction SilentlyContinue
142
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Uninstall `$ProductName.lnk") -Force -ErrorAction SilentlyContinue
143
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Regen.MDeditor.lnk") -Force -ErrorAction SilentlyContinue
144
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Manuscript Forge.lnk") -Force -ErrorAction SilentlyContinue
145
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Uninstall Regen.MDeditor.lnk") -Force -ErrorAction SilentlyContinue
146
+ foreach (`$ext in @(".md", ".docx")) {
147
+ foreach (`$verb in @("RegenMDEditorOpen", "ManuscriptForgeOpen", "BuildCorpusOpenEditor")) {
148
+ Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\`$ext\shell\`$verb" -Recurse -Force -ErrorAction SilentlyContinue
149
+ }
150
+ }
151
+ for (`$i = 0; `$i -lt 10; `$i++) {
152
+ Start-Sleep -Milliseconds 250
153
+ try {
154
+ Remove-Item -LiteralPath `$InstallDir -Recurse -Force
155
+ break
156
+ } catch {
157
+ if (`$i -eq 9) { throw }
158
+ }
159
+ }
160
+ Write-Host "`$ProductName removed."
161
+ "@
162
+ Set-Content -LiteralPath $UninstallScript -Value $uninstall -Encoding UTF8
163
+
164
+ $uninstallShortcut = $shell.CreateShortcut($UninstallShortcutPath)
165
+ $uninstallShortcut.TargetPath = "powershell.exe"
166
+ $uninstallShortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -File `"$UninstallScript`""
167
+ $uninstallShortcut.WorkingDirectory = $InstallDir
168
+ $uninstallShortcut.IconLocation = "$InstalledExe,0"
169
+ $uninstallShortcut.Description = "Uninstall $ProductName"
170
+ $uninstallShortcut.Save()
171
+
172
+ Write-Host "$ProductName installed."
173
+ Write-Host "InstallDir=$InstallDir"
174
+ Write-Host "Shortcut=$ShortcutPath"
175
+ Write-Host "Executable=$InstalledExe"
@@ -0,0 +1,81 @@
1
+ !ifndef VERSION
2
+ !define VERSION "0.2.1"
3
+ !endif
4
+ !ifndef APP_SOURCE
5
+ !error "APP_SOURCE must point to the staged app directory"
6
+ !endif
7
+ !ifndef OUT_FILE
8
+ !define OUT_FILE "regen.mde-${VERSION}-win-x64-setup.exe"
9
+ !endif
10
+
11
+ Unicode true
12
+ Name "regen.mde"
13
+ OutFile "${OUT_FILE}"
14
+ InstallDir "$LOCALAPPDATA\Programs\regen.mde"
15
+ RequestExecutionLevel user
16
+ SetCompressor /SOLID lzma
17
+
18
+ !include LogicLib.nsh
19
+
20
+ Var StartMenuDir
21
+
22
+ Function .onInit
23
+ StrCpy $StartMenuDir "$SMPROGRAMS\LIFE AI"
24
+ FunctionEnd
25
+
26
+ Section "Install"
27
+ SetShellVarContext current
28
+
29
+ ; Remove earlier app identities and npm-era shell verbs before installing.
30
+ RMDir /r "$LOCALAPPDATA\Programs\Manuscript Forge"
31
+ RMDir /r "$LOCALAPPDATA\Programs\Regen.MDeditor"
32
+ Delete "$SMPROGRAMS\LIFE AI\Manuscript Forge.lnk"
33
+ Delete "$SMPROGRAMS\LIFE AI\Regen.MDeditor.lnk"
34
+ Delete "$SMPROGRAMS\LIFE AI\Uninstall Regen.MDeditor.lnk"
35
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
36
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
37
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
38
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
39
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
40
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
41
+
42
+ SetOutPath "$INSTDIR"
43
+ File /r "${APP_SOURCE}\*.*"
44
+
45
+ WriteUninstaller "$INSTDIR\uninstall.exe"
46
+ CreateDirectory "$StartMenuDir"
47
+ CreateShortcut "$StartMenuDir\regen.mde.lnk" "$INSTDIR\BuildCorpusEditor.exe" "" "$INSTDIR\BuildCorpusEditor.exe" 0
48
+ CreateShortcut "$StartMenuDir\Uninstall regen.mde.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\BuildCorpusEditor.exe" 0
49
+
50
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen.mde"
51
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
52
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
53
+
54
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen.mde"
55
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
56
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
57
+
58
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen.mde" "DisplayName" "regen.mde"
59
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen.mde" "DisplayVersion" "${VERSION}"
60
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen.mde" "Publisher" "LIFE AI"
61
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen.mde" "InstallLocation" "$INSTDIR"
62
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen.mde" "DisplayIcon" "$INSTDIR\BuildCorpusEditor.exe"
63
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen.mde" "UninstallString" '"$INSTDIR\uninstall.exe"'
64
+ SectionEnd
65
+
66
+ Section "Uninstall"
67
+ SetShellVarContext current
68
+ Delete "$SMPROGRAMS\LIFE AI\regen.mde.lnk"
69
+ Delete "$SMPROGRAMS\LIFE AI\Uninstall regen.mde.lnk"
70
+ RMDir "$SMPROGRAMS\LIFE AI"
71
+
72
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
73
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
74
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
75
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
76
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
77
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
78
+ DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen.mde"
79
+
80
+ RMDir /r "$INSTDIR"
81
+ SectionEnd
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "regen.mde",
3
+ "version": "0.2.2",
4
+ "description": "Convert DOCX to Markdown with tables, images, and KaTeX-readable Word equations.",
5
+ "bin": {
6
+ "build-corpus": "bin/build-corpus.js",
7
+ "build-corpus-editor": "bin/build-corpus-editor.js",
8
+ "regen.mde": "bin/build-corpus-editor.js",
9
+ "regen.mdeditor": "bin/build-corpus-editor.js",
10
+ "regen-mdeditor": "bin/build-corpus-editor.js",
11
+ "regen-mdeditor-install": "bin/regen-mdeditor-install.js",
12
+ "regen-mdeditor-uninstall": "bin/regen-mdeditor-uninstall.js",
13
+ "build-corpus-katex": "bin/validate-katex.js"
14
+ },
15
+ "files": [
16
+ "bin/",
17
+ "desktop/BuildCorpusEditor/*.cs",
18
+ "desktop/BuildCorpusEditor/*.csproj",
19
+ "desktop/BuildCorpusEditor/*.manifest",
20
+ "dist/release/regen.mde-*-win-x64-setup.exe",
21
+ "dist/release/regen.mde-*-win-x64.zip",
22
+ "dist/windows-editor/",
23
+ "editor-web/",
24
+ "installer/",
25
+ "src/build_corpus/*.py",
26
+ "src/build_corpus/templates/*.py",
27
+ "src/build_corpus/templates/*.dotx",
28
+ "examples/",
29
+ "scripts/",
30
+ "tools/*.py",
31
+ "pyproject.toml",
32
+ "requirements.txt",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "scripts": {
37
+ "editor:build": "vite build --config editor-web/vite.config.js",
38
+ "editor:windows": "powershell.exe -ExecutionPolicy Bypass -File scripts/build-windows-editor.ps1",
39
+ "editor:package": "powershell.exe -ExecutionPolicy Bypass -File scripts/package-windows-editor.ps1",
40
+ "test:conversion": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/run-required-tests.ps1 -Suite Conversion",
41
+ "test:editor": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/run-required-tests.ps1 -Suite Editor",
42
+ "test:required": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/run-required-tests.ps1 -Suite Auto",
43
+ "test:all": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/run-required-tests.ps1 -Suite All",
44
+ "prepack": "npm run editor:windows && npm run editor:package",
45
+ "postinstall": "node bin/postinstall.js",
46
+ "preuninstall": "node bin/postinstall.js --uninstall",
47
+ "test": "node bin/build-corpus.js --help && node bin/validate-katex.js README.md"
48
+ },
49
+ "dependencies": {
50
+ "@tiptap/extension-bubble-menu": "^3.23.1",
51
+ "@tiptap/extension-floating-menu": "^3.23.1",
52
+ "@tiptap/extension-image": "^3.23.1",
53
+ "@tiptap/extension-link": "^3.23.1",
54
+ "@tiptap/extension-placeholder": "^3.23.1",
55
+ "@tiptap/extension-table": "^3.23.1",
56
+ "@tiptap/extension-table-cell": "^3.23.1",
57
+ "@tiptap/extension-table-header": "^3.23.1",
58
+ "@tiptap/extension-table-row": "^3.23.1",
59
+ "@tiptap/extension-task-item": "^3.23.1",
60
+ "@tiptap/extension-task-list": "^3.23.1",
61
+ "@tiptap/react": "^3.23.1",
62
+ "@tiptap/starter-kit": "^3.23.1",
63
+ "katex": "^0.16.22",
64
+ "marked": "^15.0.12",
65
+ "react": "^19.2.6",
66
+ "react-dom": "^19.2.6",
67
+ "turndown": "^7.2.4"
68
+ },
69
+ "keywords": [
70
+ "docx",
71
+ "markdown",
72
+ "word",
73
+ "omml",
74
+ "katex",
75
+ "converter"
76
+ ],
77
+ "author": "LIFE AI",
78
+ "license": "Apache-2.0",
79
+ "engines": {
80
+ "node": ">=18"
81
+ },
82
+ "devDependencies": {
83
+ "@vitejs/plugin-react": "^4.7.0",
84
+ "vite": "^6.4.2"
85
+ }
86
+ }
package/pyproject.toml ADDED
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "build-corpus"
7
+ version = "0.2.0"
8
+ description = "Convert DOCX to Markdown with tables, images, and KaTeX-readable Word equations."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "Apache-2.0"
12
+ authors = [
13
+ { name = "LIFE AI" }
14
+ ]
15
+ keywords = ["docx", "markdown", "omml", "katex", "word", "converter"]
16
+ dependencies = [
17
+ "omml2latex>=0.1.1",
18
+ "Pillow>=10.0.0",
19
+ "python-docx>=1.1.2"
20
+ ]
21
+
22
+ [project.optional-dependencies]
23
+ s3 = ["boto3>=1.34"]
24
+ dev = ["build>=1.2", "twine>=5.0"]
25
+
26
+ [project.scripts]
27
+ "build-corpus" = "build_corpus.exporter:main"
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+
32
+ [tool.setuptools.package-data]
33
+ build_corpus = ["templates/*.dotx"]
@@ -0,0 +1,4 @@
1
+ omml2latex>=0.1.1
2
+ boto3>=1.34
3
+ Pillow>=10.0.0
4
+ python-docx>=1.1.2
@@ -0,0 +1,47 @@
1
+ [CmdletBinding()]
2
+ param(
3
+ [string]$Root = ""
4
+ )
5
+
6
+ $ErrorActionPreference = "Stop"
7
+
8
+ if ([string]::IsNullOrWhiteSpace($Root)) {
9
+ $Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
10
+ }
11
+
12
+ function Invoke-Checked {
13
+ param([string]$FilePath, [string[]]$Arguments)
14
+ Write-Host "+ $FilePath $($Arguments -join ' ')" -ForegroundColor DarkGray
15
+ Push-Location $Root
16
+ try {
17
+ & $FilePath @Arguments
18
+ $exitCode = if ($LASTEXITCODE -is [int]) { $LASTEXITCODE } else { 0 }
19
+ } finally {
20
+ Pop-Location
21
+ }
22
+ if ($exitCode -ne 0) {
23
+ throw "Command failed with exit code ${exitCode}: $FilePath $($Arguments -join ' ')"
24
+ }
25
+ }
26
+
27
+ Invoke-Checked "npm" @("run", "editor:build")
28
+
29
+ Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force
30
+
31
+ Invoke-Checked "dotnet" @(
32
+ "publish",
33
+ "desktop\BuildCorpusEditor\BuildCorpusEditor.csproj",
34
+ "-c", "Release",
35
+ "-r", "win-x64",
36
+ "--self-contained", "false",
37
+ "-o", "dist\windows-editor"
38
+ )
39
+
40
+ $exe = Join-Path $Root "dist\windows-editor\BuildCorpusEditor.exe"
41
+ if (-not (Test-Path -LiteralPath $exe)) {
42
+ throw "Expected executable missing: $exe"
43
+ }
44
+
45
+ Remove-Item -LiteralPath (Join-Path $Root "dist\windows-editor\BuildCorpusEditor.exe.WebView2") -Recurse -Force -ErrorAction SilentlyContinue
46
+
47
+ Write-Host "Built $exe" -ForegroundColor Green
@@ -0,0 +1,90 @@
1
+ [CmdletBinding()]
2
+ param(
3
+ [string]$Root = "",
4
+ [string]$Version = ""
5
+ )
6
+
7
+ $ErrorActionPreference = "Stop"
8
+
9
+ if ([string]::IsNullOrWhiteSpace($Root)) {
10
+ $Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
11
+ }
12
+
13
+ if ([string]::IsNullOrWhiteSpace($Version)) {
14
+ $pkg = Get-Content -Raw -LiteralPath (Join-Path $Root "package.json") | ConvertFrom-Json
15
+ $Version = $pkg.version
16
+ }
17
+
18
+ $releaseRoot = Join-Path $Root "dist\release"
19
+ $stage = Join-Path $releaseRoot "regen.mde-$Version-win-x64"
20
+ $app = Join-Path $stage "app"
21
+ $zip = Join-Path $releaseRoot "regen.mde-$Version-win-x64.zip"
22
+ $setupExe = Join-Path $releaseRoot "regen.mde-$Version-win-x64-setup.exe"
23
+
24
+ Remove-Item -LiteralPath $stage -Recurse -Force -ErrorAction SilentlyContinue
25
+ Remove-Item -LiteralPath $zip -Force -ErrorAction SilentlyContinue
26
+ Remove-Item -LiteralPath $setupExe -Force -ErrorAction SilentlyContinue
27
+ New-Item -ItemType Directory -Force -Path $app | Out-Null
28
+
29
+ Copy-Item -Path (Join-Path $Root "dist\windows-editor\*") -Destination $app -Recurse -Force
30
+ Remove-Item -LiteralPath (Join-Path $app "BuildCorpusEditor.exe.WebView2") -Recurse -Force -ErrorAction SilentlyContinue
31
+ Copy-Item -LiteralPath (Join-Path $Root "bin") -Destination $app -Recurse -Force
32
+ Copy-Item -LiteralPath (Join-Path $Root "src") -Destination $app -Recurse -Force
33
+ Copy-Item -LiteralPath (Join-Path $Root "requirements.txt") -Destination $app -Force
34
+ Copy-Item -LiteralPath (Join-Path $Root "pyproject.toml") -Destination $app -Force
35
+ Copy-Item -LiteralPath (Join-Path $Root "package.json") -Destination $app -Force
36
+ Copy-Item -LiteralPath (Join-Path $Root "package-lock.json") -Destination $app -Force
37
+
38
+ Copy-Item -LiteralPath (Join-Path $Root "installer\install-regen-mde.ps1") -Destination $stage -Force
39
+
40
+ $readme = @"
41
+ regen.mde for Windows
42
+ =====================
43
+
44
+ Install:
45
+ Right-click install-regen-mde.ps1 and choose "Run with PowerShell"
46
+
47
+ After install:
48
+ Open the Windows Start menu and search for "regen.mde".
49
+ Right-click .md or .docx files and choose "Open in regen.mde".
50
+ Use "Uninstall regen.mde" from the Start menu to remove the app and shell verbs.
51
+
52
+ Requirements:
53
+ Windows with Microsoft Edge WebView2 runtime
54
+ Node.js on PATH
55
+ Python 3 on PATH with the Build Corpus Python requirements installed
56
+
57
+ The installer copies the app to:
58
+ %LOCALAPPDATA%\Programs\regen.mde
59
+ "@
60
+ Set-Content -LiteralPath (Join-Path $stage "README-INSTALL.txt") -Value $readme -Encoding UTF8
61
+
62
+ Compress-Archive -Path (Join-Path $stage "*") -DestinationPath $zip -Force
63
+
64
+ if (-not (Test-Path -LiteralPath $zip)) {
65
+ throw "Package zip was not created: $zip"
66
+ }
67
+
68
+ $makensis = @(
69
+ "C:\Program Files (x86)\NSIS\makensis.exe",
70
+ "C:\Program Files (x86)\NSIS\Bin\makensis.exe"
71
+ ) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1
72
+
73
+ if ($makensis) {
74
+ & $makensis `
75
+ "/DVERSION=$Version" `
76
+ "/DAPP_SOURCE=$app" `
77
+ "/DOUT_FILE=$setupExe" `
78
+ (Join-Path $Root "installer\regen-mde.nsi")
79
+ if ($LASTEXITCODE -ne 0) {
80
+ throw "NSIS installer build failed with exit code $LASTEXITCODE"
81
+ }
82
+ if (-not (Test-Path -LiteralPath $setupExe)) {
83
+ throw "Installer exe was not created: $setupExe"
84
+ }
85
+ Write-Host "Packaged $setupExe"
86
+ } else {
87
+ Write-Warning "NSIS makensis.exe was not found; skipped setup EXE package."
88
+ }
89
+
90
+ Write-Host "Packaged $zip"
@@ -0,0 +1,28 @@
1
+ param(
2
+ [Parameter(Mandatory=$true)]
3
+ [string]$Source,
4
+
5
+ [string]$Out = ".tmp\corpus",
6
+
7
+ [ValidateSet("assets", "base64", "s3")]
8
+ [string]$Images = "assets",
9
+
10
+ [string]$Config = ""
11
+ )
12
+
13
+ $ErrorActionPreference = "Stop"
14
+ $root = Split-Path -Parent $PSScriptRoot
15
+ $buildCorpus = Join-Path $root "bin\build-corpus.js"
16
+ $katex = Join-Path $root "bin\validate-katex.js"
17
+ $assetValidator = Join-Path $root "src\build_corpus\validate_assets.py"
18
+
19
+ $args = @($buildCorpus, $Source, "--out", $Out, "--images", $Images)
20
+ if ($Config) {
21
+ $args += @("--config", $Config)
22
+ }
23
+
24
+ node @args
25
+ node $katex $Out | Set-Content -Path (Join-Path $Out "katex-report.json") -Encoding UTF8
26
+ py -3 $assetValidator $Out | Set-Content -Path (Join-Path $Out "asset-report.json") -Encoding UTF8
27
+
28
+ Write-Host "Corpus test passed: $Out"