Skip to content

Commit 796f78a

Browse files
committed
release: Ferrite v0.2.1 - Mermaid diagram improvements
Sequence: control-flow blocks, activation boxes, notes Flowchart: subgraphs, branching layout, back-edge routing State: composite/nested states, advanced transitions General: accurate text measurement, dynamic node sizing
1 parent a700e82 commit 796f78a

14 files changed

Lines changed: 4741 additions & 665 deletions

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ desktop.ini
4343
*.pem
4444
*.key
4545

46+
# AI agent configurations and instructions
47+
.mcp.json
48+
.rules
49+
opencode.json
50+
AGENT.md
51+
AGENTS.md
52+
CLAUDE.md
53+
GEMINI.md
54+
.clinerules/
55+
.gemini/
56+
.kilo/
57+
.kiro/
58+
.roo/
59+
.trae/
60+
.windsurf/
61+
.zed/
62+
.github/instructions/
63+
4664
# Logs
4765
logs/
4866
*.log
@@ -81,3 +99,15 @@ temp/
8199
# Test artifacts
82100
*.test
83101
test-output/
102+
103+
logs
104+
# Dependency directories
105+
# Environment variables
106+
# Editor directories and files
107+
.idea
108+
.vscode
109+
# OS specific
110+
111+
# Task files
112+
# tasks.json
113+
# tasks/

CHANGELOG.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.2.1] - 2025-01-10
11+
12+
### Added
13+
14+
#### Mermaid Diagram Enhancements
15+
- **Sequence Diagram Control Blocks** - Full support for `loop`, `alt`, `opt`, `par`, `critical`, `break` blocks with proper nesting and colored labels
16+
- **Sequence Activation Boxes** - `activate`/`deactivate` commands and `+`/`-` shorthand on messages for lifeline activation tracking
17+
- **Sequence Notes** - `Note left/right/over` syntax with dog-ear corner rendering
18+
- **Flowchart Subgraphs** - Nested `subgraph`/`end` blocks with semi-transparent backgrounds and direction overrides
19+
- **Composite/Nested States** - State diagrams now support `state Parent { ... }` syntax with recursive nesting
20+
- **Advanced State Transitions** - Color-coded transitions, smart anchor points, and cross-nesting-level edge routing
21+
22+
#### Layout Improvements
23+
- **Flowchart Branching** - Sugiyama-style layered graph layout with proper side-by-side branch placement
24+
- **Cycle Detection** - Back-edges rendered with smooth bezier curves instead of crossing lines
25+
- **Smart Edge Routing** - Decision node edges exit from different points to prevent crossing
26+
- **Edge Declaration Order** - Branch ordering now matches Mermaid's convention (later-declared edges go left)
27+
28+
### Fixed
29+
- **Text Measurement** - Replaced character-count estimation with egui font metrics for accurate node sizing
30+
- **Node Overflow** - Nodes dynamically resize to fit their labels without clipping
31+
- **Edge Labels** - Long labels truncate with ellipsis instead of overflowing
32+
- **User Journey Icons** - Fixed unsupported emoji rendering with text fallbacks
33+
34+
### Technical
35+
- Extended `mermaid.rs` from ~4000 to ~6000+ lines
36+
- Added technical documentation for all new features in `docs/technical/`
37+
1038
## [0.2.0] - 2025-01-09
1139

1240
### Added
@@ -114,9 +142,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
114142

115143
## Version History
116144

145+
- **0.2.1** - Mermaid diagram improvements (control blocks, subgraphs, nested states, improved layout)
117146
- **0.2.0** - Major feature release (Split View, Mermaid, Minimap, Git integration, and more)
118147
- **0.1.0** - Initial public release
119148

120-
[Unreleased]: https://github.com/OlaProeis/Ferrite/compare/v0.2.0...HEAD
149+
[Unreleased]: https://github.com/OlaProeis/Ferrite/compare/v0.2.1...HEAD
150+
[0.2.1]: https://github.com/OlaProeis/Ferrite/compare/v0.2.0...v0.2.1
121151
[0.2.0]: https://github.com/OlaProeis/Ferrite/compare/v0.1.0...v0.2.0
122152
[0.1.0]: https://github.com/OlaProeis/Ferrite/releases/tag/v0.1.0

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ferrite"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55
description = "A fast, lightweight text editor for Markdown, JSON, and more"
66
repository = "https://github.com/OlaProeis/Ferrite"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Native rendering of 11 diagram types directly in the preview:
4444
- Flowchart, Sequence, Pie, State, Mindmap
4545
- Class, ER, Git Graph, Gantt, Timeline, User Journey
4646

47-
> 📦 **v0.2.1 Coming Soon:** Enhanced Mermaid support with sequence control-flow blocks (`loop`, `alt`, `opt`, `par`), improved text sizing, flowchart subgraphs, and more. See [ROADMAP.md](ROADMAP.md) for details.
47+
> **v0.2.1 Released:** Enhanced Mermaid support with sequence control-flow blocks (`loop`, `alt`, `opt`, `par`), activation boxes, notes, flowchart subgraphs with branching layout, and composite/nested states. See [CHANGELOG.md](CHANGELOG.md) for full details.
4848
4949
### Workspace Features
5050
- **Workspace Mode** - Open folders with file tree, quick switcher (Ctrl+P), and search-in-files (Ctrl+Shift+F)

ROADMAP.md

Lines changed: 63 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,79 +12,96 @@ These issues cannot be fixed without replacing egui's built-in text editor:
1212

1313
## Planned Features 🚀
1414

15-
### v0.2.1 (In Progress) - Mermaid Diagram Improvements
15+
### v0.3.0 (Planned) - Mermaid Crate + Editor Improvements
1616

17-
> **Status:** Active development
18-
> **Focus:** Polish and complete native Mermaid diagram rendering
17+
> **Status:** Planning
18+
> **Docs:** [Mermaid Crate Plan](docs/mermaid-crate-plan.md) | [Custom Editor Plan](docs/technical/custom-editor-widget-plan.md) | [Modular Refactor Plan](docs/refactor.md)
1919
20-
This patch release focuses on improving the native Mermaid diagram renderer added in v0.2.0:
20+
v0.3.0 focuses on extracting the Mermaid renderer as a standalone crate and continuing diagram improvements.
2121

22-
#### Text & Layout Fixes
23-
- [x] **Accurate text measurement** - Replace character-count estimation with egui font metrics
24-
- [x] **Dynamic node sizing** - Nodes resize to fit their labels without clipping
25-
- [x] **Text overflow handling** - Edge labels truncate with ellipsis when too long
26-
- [x] **User Journey icons** - Fixed unsupported emoji rendering
22+
#### 1. Mermaid Crate Extraction
23+
Extract Ferrite's native Mermaid renderer (~6000 lines) into a standalone pure-Rust crate.
2724

28-
#### Sequence Diagram Enhancements
29-
- [x] **Control-flow blocks** - Support for `loop`, `alt`, `opt`, `par` blocks with nesting
30-
- [ ] **Activation boxes** - `activate`/`deactivate` markers on lifelines
31-
- [ ] **Notes** - `Note left/right/over` syntax support
25+
- [ ] **Standalone crate** - Backend-agnostic architecture with SVG, PNG, and egui outputs
26+
- [ ] **Public API** - `parse()`, `layout()`, `render()` pipeline
27+
- [ ] **SVG export** - Generate valid SVG files from diagrams
28+
- [ ] **PNG export** - Rasterize via resvg
29+
- [ ] **WASM compatible** - SVG backend works in browsers
3230

33-
#### Flowchart Improvements
34-
- [ ] **Proper branching layout** - Fix single-column rendering, implement multi-path layout
35-
- [ ] **Subgraph support** - Nested subgraphs with direction overrides
31+
#### 2. Mermaid Diagram Improvements
32+
Continue improving diagram rendering quality:
3633

37-
#### State Diagram Enhancements
38-
- [ ] **Composite states** - Nested state machines
39-
- [ ] **Advanced transitions** - Fork/join, choice pseudostates
40-
41-
---
34+
##### Git Graph (Major Rewrite)
35+
- [ ] **Horizontal timeline layout** - Left-to-right commit flow like Mermaid
36+
- [ ] **Branch lanes** - Distinct horizontal lanes per branch with colored labels
37+
- [ ] **Merge visualization** - Curved paths connecting branches
38+
- [ ] **Tags and highlights** - Visual markers on commits
4239

43-
### v0.3.0 (Planned) - Custom Editor + Modular Architecture
40+
##### Flowchart
41+
- [ ] **More node shapes** - Parallelogram, trapezoid, double-circle, etc.
42+
- [ ] **Styling syntax** - `style` and `classDef` directives
4443

45-
> **Status:** Collecting v0.2.0 feedback before implementation
46-
> **Docs:** [Custom Editor Plan](docs/technical/custom-editor-widget-plan.md) | [Modular Refactor Plan](docs/refactor.md)
44+
##### State Diagram
45+
- [ ] **Fork/join pseudostates** - Parallel regions
46+
- [ ] **History states** - Shallow (H) and deep (H*) history
4747

48-
v0.3.0 is a foundational release with two major architectural changes:
49-
50-
#### 1. Custom Editor Widget
48+
#### 3. Custom Editor Widget (Stretch Goal)
5149
Replace egui's `TextEdit` with a custom `FerriteEditor` widget to unblock advanced editing features.
5250

5351
- [ ] **FerriteEditor widget** - Custom text editor using egui drawing primitives
5452
- [ ] **Rope-based buffer** - Efficient text storage via `ropey` crate
55-
- [ ] **Full input handling** - Direct keyboard/mouse event processing
5653
- [ ] **Full multi-cursor editing** - Text operations at all cursor positions
5754
- [ ] **Code folding with text hiding** - Actually collapse regions visually
58-
- [ ] **Perfect scroll sync** - Direct line-to-pixel mapping access
59-
60-
#### 2. Modular Architecture Refactor
61-
Transform Ferrite from monolithic to "Core + Features" using Rust's compile-time feature flags.
62-
63-
- [ ] **Feature-gated dependencies** - `markdown`, `json`, `yaml`, `syntax_highlighting`, `git` as optional
64-
- [ ] **DocumentView enum** - Type-safe file handling with `#[cfg(feature)]` variants
65-
- [ ] **Feature switchboard** - Central file-type detection with graceful fallback to plain text
66-
- [ ] **Directory restructure** - Move specialized code to `src/features/` module
67-
68-
**Benefits:**
69-
- Compile minimal builds (`cargo build --no-default-features`)
70-
- Faster dev cycles (disable unused features)
71-
- Smaller binaries for users who don't need all formats
72-
- Future WASM compatibility
7355

74-
#### Additional v0.3.0 Goals
75-
- [ ] **Split view preview editing** - Make edits in preview persist
56+
#### Platform & Distribution
57+
- [ ] **macOS app signing & notarization** - Create proper `.app` bundle, sign with Developer ID, notarize with Apple
7658

7759
### Future (v0.4.0+)
7860
- [ ] Spell checking
7961
- [ ] Custom themes (import/export)
8062
- [ ] Virtual/ghost text (AI completions, etc.)
8163
- [ ] Column/box selection
8264

65+
### Long-Term Vision
66+
67+
#### Headless Editor Library
68+
Extract `FerriteEditor` as a standalone, framework-agnostic text editing library for the Rust ecosystem.
69+
70+
> **Context:** There's currently no general-purpose "headless" code editor library in Rust. Existing implementations (egui's TextEdit, Lapce/Floem, Zed/gpui) are tightly coupled to their UI frameworks. The v0.3.0 custom editor and modular architecture lay the groundwork for potential extraction.
71+
72+
**Prerequisites (from v0.3.0):**
73+
- Custom `FerriteEditor` widget with rope-based buffer
74+
- Modular architecture with clean separation of concerns
75+
- Framework-agnostic core logic
76+
77+
**Extraction would involve:**
78+
- [ ] Abstract rendering backend (trait-based: egui, wgpu, vello, SVG, etc.)
79+
- [ ] Framework-agnostic input handling
80+
- [ ] Standalone crate with minimal dependencies
81+
- [ ] Integration with [Parley](https://github.com/linebender/parley) for advanced text layout/shaping (optional)
82+
8383
---
8484

8585
## Completed ✅
8686

87-
### v0.2.0 (Current Release)
87+
### v0.2.1 (Current Release)
88+
89+
#### Mermaid Diagram Enhancements
90+
- [x] **Accurate text measurement** - Replace character-count estimation with egui font metrics
91+
- [x] **Dynamic node sizing** - Nodes resize to fit their labels without clipping
92+
- [x] **Text overflow handling** - Edge labels truncate with ellipsis when too long
93+
- [x] **User Journey icons** - Fixed unsupported emoji rendering with text fallbacks
94+
- [x] **Sequence control-flow blocks** - Support for `loop`, `alt`, `opt`, `par`, `critical`, `break` blocks with nesting
95+
- [x] **Sequence activation boxes** - `activate`/`deactivate` markers and `+`/`-` shorthand on lifelines
96+
- [x] **Sequence notes** - `Note left/right/over` syntax support with dog-ear rendering
97+
- [x] **Flowchart branching layout** - Sugiyama-style layered graph with side-by-side branches
98+
- [x] **Flowchart subgraphs** - Nested `subgraph`/`end` blocks with direction overrides
99+
- [x] **Back-edge routing** - Cycle edges rendered with smooth bezier curves
100+
- [x] **Smart edge exit points** - Decision node edges exit from different points to prevent crossing
101+
- [x] **Composite/nested states** - `state Parent { ... }` syntax with recursive nesting
102+
- [x] **Advanced state transitions** - Color-coded transitions and smart anchor points
103+
104+
### v0.2.0
88105

89106
#### Major Features
90107
- [x] **Side-by-side split view** - Raw editor on left, rendered preview on right with resizable divider

docs/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,15 @@ A fast, lightweight text editor for Markdown, JSON, and more. Built with Rust an
6868
| [Search Panel Viewport](./technical/search-panel-viewport.md) | Viewport constraints for Search panel, DPI handling, resize behavior |
6969
| [Ribbon Redesign](./technical/ribbon-redesign.md) | Design C streamlined ribbon, title bar integration, dropdown menus |
7070
| [Mermaid Diagrams](./technical/mermaid-diagrams.md) | MermaidJS code block detection, diagram type indicators, styled rendering |
71+
| [Mermaid Text Measurement](./technical/mermaid-text-measurement.md) | TextMeasurer trait, dynamic node sizing, egui font metrics integration |
72+
| [Sequence Control Blocks](./technical/sequence-control-blocks.md) | Sequence diagram loop/alt/opt/par blocks, nested parsing, block rendering |
73+
| [Flowchart Layout Algorithm](./technical/flowchart-layout-algorithm.md) | Sugiyama-style layered graph layout, cycle detection, crossing reduction |
74+
| [Flowchart Subgraphs](./technical/flowchart-subgraphs.md) | Flowchart subgraph support, nested parsing, bounding box computation |
75+
| [Sequence Activations & Notes](./technical/sequence-activations-notes.md) | Activation boxes, notes, +/- shorthand, state tracking |
7176
| [Editor Minimap](./technical/minimap.md) | VS Code-style minimap navigation, click-to-navigate, search highlights, split view support |
7277
| [Branding](./branding.md) | Icon design, asset generation, platform integration guidelines |
7378
| **[Custom Editor Widget Plan](./technical/custom-editor-widget-plan.md)** | **v0.3.0 planning: Replace egui TextEdit with custom FerriteEditor widget** |
79+
| **[Mermaid Crate Plan](./mermaid-crate-plan.md)** | **Extract Mermaid renderer as standalone pure-Rust crate** |
7480

7581
---
7682

0 commit comments

Comments
 (0)