Skip to main content

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).

CI Build & Release Binaries

PyMarkdownEditor


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 .md with 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.py wires services + registers exporters
  • Interfaces/Models: domain/
  • Services: rendering, file IO (atomic), settings, export strategies
  • UI: a thin MainWindow that 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 QPrinter fails 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

py_markdown_editor-0.8.4.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_markdown_editor-0.8.4-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

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

Hashes for py_markdown_editor-0.8.4.tar.gz
Algorithm Hash digest
SHA256 84cc177330e11c400fd2ace37e56d80bf7239e09c2c6125486f3db41141d76aa
MD5 2785ea56210e88b32d50eb65e8f4ea07
BLAKE2b-256 b77c307e6f472e6bf0753b62dad1e1525ef445f9955f237797dde0b66a95cf0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_markdown_editor-0.8.4.tar.gz:

Publisher: publish.yml on clintonshane84/PyMarkdownEditor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_markdown_editor-0.8.4-py3-none-any.whl.

File metadata

File hashes

Hashes for py_markdown_editor-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 89e348c80976b2d80913855967e82c7342d47ed0723fe4e3376f71e480880357
MD5 214b3e6b6ac23a004afb4597ea90efa1
BLAKE2b-256 d20e4970f4514143d4dd6be1340d1fc3603fd5cb9a9473da032690f77127a130

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_markdown_editor-0.8.4-py3-none-any.whl:

Publisher: publish.yml on clintonshane84/PyMarkdownEditor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page