github Epistates/treemd v0.1.6

latest releases: v0.5.12, v0.5.11, v0.5.10...
8 months ago

[0.1.6] - 2025-01-09

Fixed

  • TUI section extraction with inline markdown - Fixed critical bug where selecting headings with inline formatting (like **bold**) would display the entire document instead of just that section
  • JSON output content extraction - Fixed nested JSON output where parent sections incorrectly included child heading text in their content
  • Parent directory completions - Shell completions now work with ../ relative paths and absolute paths, enabling navigation to parent directories

Added

  • Offset-based parsing - Implemented pulldown-cmark's into_offset_iter() for direct byte offset tracking, eliminating fragile string searching
  • Shared utilities module - Created parser/utils.rs with strip_markdown_inline() and get_heading_level() helpers
  • Comprehensive test suite - Added 8+ new tests covering bold headings, numbered headings, offset tracking, and section extraction edge cases
  • Context-aware completions - Upgraded from ArgValueCandidates to ArgValueCompleter for dynamic path-based completions

Changed

  • Heading struct enhancement - Added offset: usize field to store byte position for O(1) section extraction
  • Parser optimization - Changed from O(n²) string searching to O(n) offset-based extraction
  • Code deduplication - Eliminated 40+ lines of duplicate code by centralizing utilities
  • Completion logic - Completions now parse input path to determine target directory and filter appropriately

Technical

  • DRY principle compliance - Removed duplicate strip_markdown_inline and get_heading_level functions
  • Best practices adoption - Using pulldown-cmark's built-in offset tracking as recommended by Rust markdown ecosystem
  • Performance improvement - Section extraction now O(1) lookup instead of O(n) string search
  • Robustness improvement - Handles all inline markdown formatting (bold, italic, code, strikethrough) correctly
  • Architecture cleanup - Better separation of concerns with dedicated utils module
  • Zero clippy warnings - Clean codebase with all lints addressed

Full Changelog: v0.1.5...v0.1.6

Don't miss a new treemd release

NewReleases is sending notifications on new releases.