Skip to content

Latest commit

 

History

History
87 lines (62 loc) · 3.18 KB

File metadata and controls

87 lines (62 loc) · 3.18 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

0.2.0 - 2026-02-13

Added

  • Core API: content_hash(code, language) — deterministic SHA-256 hash for (code, language) pairs, for block-level cache keys
  • Core API: content_hash() now accepts optional hl_lines and show_linenos for cache keys of complex blocks (line highlighting, line numbers)
  • Parallel API: HighlightItem dataclass and extended highlight_many() — supports hl_lines and show_linenos for full parallel batch highlighting

Changed

  • HTML Formatter: Pre-compute prefixed span templates from class name mappings instead of parsing HTML strings at runtime — fixes a fragility in the hot path
  • HTML Formatter: Extract _format_with_hl_lines() and _resolve_span_table() from format() for better maintainability of the line-highlighting slow path
  • Theme Registry: Eager initialization of palette registry at module scope with threading.Lock on register_palette() — closes a thread-safety gap
  • CI: Replace mypy with ty in the typecheck workflow to match project tooling

Added

  • Core API: _validate_range() bounds checking for start/end parameters in highlight() and tokenize() — raises ValueError on invalid ranges

Removed

  • Dead TYPE_CHECKING block in HTML formatter

0.1.0 - 2026-01-02

Initial public release of Rosettes, extracted from the Bengal static site generator.

Added

  • Core API

    • highlight() — Generate formatted output with syntax highlighting
    • tokenize() — Get raw tokens for custom processing
    • highlight_many() — Parallel highlighting for multiple blocks
    • tokenize_many() — Parallel tokenization
  • Formatter Registry

    • get_formatter() — Get formatter by name or alias
    • list_formatters() — List all supported formatters
    • supports_formatter() — Check formatter support
    • Built-in formatters: HTML, Terminal, Null
  • Lexer Registry

    • get_lexer() — Get lexer by name or alias
    • list_languages() — List all supported languages
    • supports_language() — Check language support
  • 55 Language Lexers

    • Hand-written state machines with O(n) guaranteed performance
    • Zero ReDoS vulnerabilities
    • Languages: Python, JavaScript, TypeScript, Rust, Go, C, C++, Java, Kotlin, Ruby, and 45 more
  • Styling Features

    • Semantic CSS classes (.syntax-keyword, .syntax-function, etc.)
    • Pygments-compatible classes (.k, .nf, etc.)
    • Line highlighting with hl_lines
    • Line numbers with show_linenos
  • Python 3.14t Support

    • Designed for free-threading (PEP 703)
    • Declared GIL-free safety via _Py_mod_gil
    • Thread-safe by design: lexers use only local variables

Technical Details

  • Pure Python — no runtime dependencies
  • py.typed marker for type checking
  • Comprehensive test suite