A fast, minimal PyQt6 Markdown editor with live preview and HTML/PDF export
Project description
PyMarkdownEditor
A fast, minimal PyQt6 Markdown editor with live preview, HTML/PDF export, and a clean, SOLID-friendly architecture.
Owner-led governance; contributions welcome (see CONTRIBUTIONS).
Features
- Live preview (debounced) side-by-side with the editor
- Markdown rendering via
python-markdown(+extra,fenced_code,codehilite,toc,sane_lists,smarty) - Dark-mode aware CSS for preview
- Open/Save
.mdwith atomic writes (QSaveFile, UTF-8) - Recent files (persisted with
QSettings) - Drag & drop to open files
- Exporters
- HTML – saves preview HTML as-is
- PDF – QPrinter (A4, 12.7 mm margins) to mirror preview
- Editor helpers: bold/italic/inline code, H1/H2/list, wrap toggle, preview toggle
- Architecture: SOLID, dependency injection, strategy-based exporters
Quick Start
# 1) Create and activate a venv
python -m venv .venv
# Windows
. .venv/Scripts/activate
# macOS/Linux
source .venv/bin/activate
# 2) Install runtime deps
pip install -r requirements.txt
# 3) Run
python -m pymd
# or
python pymd/main.py
Python: 3.10+ recommended
Requirements
requirements.txt
PyQt6>=6.6
Markdown>=3.5
Pygments>=2.17
(Dev/test tools live in dev-requirements.txt—see Testing below.)
Keyboard Shortcuts
-
New/Open/Save/Save As: standard platform shortcuts
-
Re-render:
Ctrl+R -
Toggle Wrap: toolbar/menu
-
Toggle Preview: toolbar/menu
-
Formatting helpers from toolbar:
**B**,*i*,`code`,# H1,## H2,- list
Project Structure
pymd/
__init__.py
__main__.py
main.py
app.py
di/
container.py
domain/
interfaces.py
models.py
services/
markdown_renderer.py
file_service.py
settings_service.py
exporters/
base.py
html_exporter.py
pdf_exporter.py
ui/
main_window.py
utils/
constants.py
- DI:
di/container.pywires services + registers exporters - Interfaces/Models:
domain/ - Services: rendering, file IO (atomic), settings, export strategies
- UI: a thin
MainWindowthat delegates to services (SOLID)
Testing
Install dev deps and run tests:
pip install -r dev-requirements.txt
pytest --cov=pymd --cov-report=term-missing
dev-requirements.txt:
pytest>=8.0
pytest-qt>=4.4
pytest-cov>=5.0
CI-friendly: tests include positive & negative paths; Qt tests avoid modal dialogs.
Build (Optional)
You can bundle with a tool like PyInstaller:
pip install pyinstaller
pyinstaller -n PyMarkdownEditor --windowed --onefile -i NONE -s -y pymd/__main__.py
(Adjust data files as needed for CSS/templates.)
Troubleshooting
- PDF export blank/empty: ensure the app has permission to write to the chosen location.
- Fonts differ in PDF vs. preview: QPrinter rasterization and available system fonts may differ; consider embedding fonts or tweaking CSS if needed.
- Windows: if
QPrinterfails under strict AV policies, try exporting to a user-writable folder.
Contributing
We welcome issues and PRs—please read:
- CONTRIBUTIONS.md – owner-led governance, DCO sign-off, PR checklist
- LICENSE – Apache-2.0
.github/CODEOWNERS(optional) – lists current code owners
Quick dev loop:
# format/lint (optional)
pip install ruff black
ruff format .
ruff check .
pytest -q
License
Apache-2.0 © 2025 clintonshane84 See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_markdown_editor-0.8.4.tar.gz.
File metadata
- Download URL: py_markdown_editor-0.8.4.tar.gz
- Upload date:
- Size: 40.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84cc177330e11c400fd2ace37e56d80bf7239e09c2c6125486f3db41141d76aa
|
|
| MD5 |
2785ea56210e88b32d50eb65e8f4ea07
|
|
| BLAKE2b-256 |
b77c307e6f472e6bf0753b62dad1e1525ef445f9955f237797dde0b66a95cf0b
|
Provenance
The following attestation bundles were made for py_markdown_editor-0.8.4.tar.gz:
Publisher:
publish.yml on clintonshane84/PyMarkdownEditor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_markdown_editor-0.8.4.tar.gz -
Subject digest:
84cc177330e11c400fd2ace37e56d80bf7239e09c2c6125486f3db41141d76aa - Sigstore transparency entry: 714169740
- Sigstore integration time:
-
Permalink:
clintonshane84/PyMarkdownEditor@ca1c120789a57fd4d7edfceed8661d7b62b7b92c -
Branch / Tag:
refs/tags/v0.8.4 - Owner: https://github.com/clintonshane84
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca1c120789a57fd4d7edfceed8661d7b62b7b92c -
Trigger Event:
push
-
Statement type:
File details
Details for the file py_markdown_editor-0.8.4-py3-none-any.whl.
File metadata
- Download URL: py_markdown_editor-0.8.4-py3-none-any.whl
- Upload date:
- Size: 41.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89e348c80976b2d80913855967e82c7342d47ed0723fe4e3376f71e480880357
|
|
| MD5 |
214b3e6b6ac23a004afb4597ea90efa1
|
|
| BLAKE2b-256 |
d20e4970f4514143d4dd6be1340d1fc3603fd5cb9a9473da032690f77127a130
|
Provenance
The following attestation bundles were made for py_markdown_editor-0.8.4-py3-none-any.whl:
Publisher:
publish.yml on clintonshane84/PyMarkdownEditor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_markdown_editor-0.8.4-py3-none-any.whl -
Subject digest:
89e348c80976b2d80913855967e82c7342d47ed0723fe4e3376f71e480880357 - Sigstore transparency entry: 714169747
- Sigstore integration time:
-
Permalink:
clintonshane84/PyMarkdownEditor@ca1c120789a57fd4d7edfceed8661d7b62b7b92c -
Branch / Tag:
refs/tags/v0.8.4 - Owner: https://github.com/clintonshane84
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca1c120789a57fd4d7edfceed8661d7b62b7b92c -
Trigger Event:
push
-
Statement type: