Skip to main content

Markdown editor with CriticMarkup support and Typora theme editor

Project description

Scriptum Simplex

A desktop Markdown editor with special support for CriticMarkup syntax, built using Python, Tkinter, and TTK Bootstrap following the Model-View-Controller (MVC) architectural pattern.

Features

  • Two-pane interface: Live editor on the left, rendered preview on the right
  • CriticMarkup support: Full support for all CriticMarkup syntax elements
  • Advanced Markdown rendering: Complete GitHub Flavored Markdown (GFM) support
    • Table rendering with column alignment (left/center/right)
    • Inline formatting in tables (bold, italic, code)
    • Code blocks with syntax highlighting
    • Lists, headings, quotes, and more
  • AST-based rendering: Direct Abstract Syntax Tree rendering for better performance
  • File operations: New, Open, Save, Save As functionality
  • Modern UI: Built with TTK Bootstrap for a modern look and feel
  • Cross-platform: Works on Windows, macOS, and Linux

CriticMarkup Syntax Supported

  • Additions: {++text to add++}
  • Deletions: {--text to delete--}
  • Substitutions: {~~old text~>new text~~}
  • Comments: {>>comment text<<}
  • Highlights: {==highlighted text==}

Table Syntax

Scriptum Simplex supports GitHub Flavored Markdown tables with column alignment:

| Left Aligned | Center Aligned | Right Aligned |
|:-------------|:--------------:|--------------:|
| Text         | Text           | Text          |
| More         | Content        | 100           |

Alignment markers:

  • :--- = Left aligned (default)
  • :---: = Center aligned
  • ---: = Right aligned

Tables support inline formatting like bold, italic, and code within cells.

Installation

  1. Clone or download this repository

  2. Install Python dependencies:

    cd criticmarkup-editor
    pip install -r requirements.txt
    
  3. Run the application:

    python main.py
    

Dependencies

  • ttkbootstrap>=1.10.1 - Modern Tkinter themes
  • marko>=2.0.0 - Markdown parser with AST support and GFM extensions
  • criticmarkup>=0.7.0 - CriticMarkup processing
  • tk_html_widgets>=0.40 - HTML rendering in Tkinter (for HTML preview)
  • pytest>=7.4.0 - Testing framework
  • mypy>=1.0.0 - Type checking (dev dependency)
  • flake8>=6.0.0 - Code linting (dev dependency)

Project Structure

scriptum-simplex/
├── editor/
│   ├── __init__.py
│   ├── main.py         # Application entry point
│   ├── model.py        # Data and business logic (Model)
│   ├── view.py         # GUI components (View)
│   └── controller.py   # Connects Model and View (Controller)
├── tests/
│   ├── __init__.py
│   ├── test_model.py       # Unit tests for the model
│   └── test_integration.py # Integration tests
├── main.py             # Main launcher script
├── requirements.txt    # Python dependencies
└── README.md          # This file

Architecture

The application follows the Model-View-Controller (MVC) pattern:

  • Model (model.py): Manages data and business logic

    • Stores raw Markdown/CriticMarkup text
    • Handles file I/O operations
    • Converts text to HTML using CriticMarkup and Markdown libraries
  • View (view.py): Manages the user interface

    • Creates the main window with two-pane layout
    • Handles user input and displays output
    • Shows dialogs and manages UI state
  • Controller (controller.py): Coordinates between Model and View

    • Handles user actions (menu clicks, text changes)
    • Updates the Model based on user input
    • Updates the View based on Model changes

Usage

  1. Start the application by running python main.py

  2. Write Markdown and CriticMarkup in the left pane:

    # My Document
    
    This is **bold** text with {++an addition++}.
    
    Here's a {~~mistake~>correction~~} in the text.
    
    {>>This is a comment about the document<<}
    
    {==This section is important==}
    
  3. See the live preview in the right pane with proper styling for CriticMarkup elements

  4. Use the File menu to:

    • Create new documents (Ctrl+N)
    • Open existing files (Ctrl+O)
    • Save your work (Ctrl+S)
    • Save with a new name (Ctrl+Shift+S)
  5. Use the Edit menu for standard editing operations:

    • Undo/Redo (Ctrl+Z/Ctrl+Y)
    • Cut/Copy/Paste (Ctrl+X/Ctrl+C/Ctrl+V)

Testing

Run the test suite to verify everything works correctly:

# Run all tests
python -m pytest tests/ -v

# Run only unit tests
python -m pytest tests/test_model.py -v

# Run only integration tests
python -m pytest tests/test_integration.py -v

Development

The codebase is well-documented and follows Python best practices:

  • Type hints for better code clarity
  • Comprehensive docstrings
  • Separation of concerns through MVC pattern
  • Extensive test coverage
  • Error handling and user feedback

Keyboard Shortcuts

  • Ctrl+N - New file
  • Ctrl+O - Open file
  • Ctrl+S - Save file
  • Ctrl+Shift+S - Save as
  • Ctrl+Z - Undo
  • Ctrl+Y - Redo
  • Ctrl+X - Cut
  • Ctrl+C - Copy
  • Ctrl+V - Paste

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite
  6. Submit a pull request

License

This project is open source. Feel free to use, modify, and distribute as needed.

Troubleshooting

Application won't start:

  • Make sure all dependencies are installed: pip install -r requirements.txt
  • Check that you're using Python 3.7 or later

Preview not updating:

  • Check the console for error messages
  • Verify that the CriticMarkup syntax is correct

File operations not working:

  • Check file permissions
  • Ensure the directory exists and is writable

For more help, check the test files for usage examples or create an issue in the repository.

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

scriptum_simplex-100.0.tar.gz (117.8 kB view details)

Uploaded Source

Built Distribution

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

scriptum_simplex-100.0-py3-none-any.whl (103.1 kB view details)

Uploaded Python 3

File details

Details for the file scriptum_simplex-100.0.tar.gz.

File metadata

  • Download URL: scriptum_simplex-100.0.tar.gz
  • Upload date:
  • Size: 117.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for scriptum_simplex-100.0.tar.gz
Algorithm Hash digest
SHA256 9d11e514dc438cdf940261c188b67a0d0f6cd5d7e987fc0b729dbadeed00e549
MD5 2ab8ffa6568a9b4cb8a950a98df3f660
BLAKE2b-256 31daa423e9d8f0da128eefddd9be0e354d80b04aba579a7fdf5bb63ecbf6da23

See more details on using hashes here.

File details

Details for the file scriptum_simplex-100.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scriptum_simplex-100.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d432237ab7e8e00cc4dc80865b3d547538bab2496ec3f2251dabd0d33434b7ae
MD5 4ed96c04bcaebc79ea7a2aa1e871dad9
BLAKE2b-256 383c91e13f5e4efb81beb7c5d196a9def551898b5517be6dcaccb8a2e4dafc92

See more details on using hashes here.

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