展示HN:铁素体 – Rust编写的Markdown编辑器,具有原生Mermaid图表渲染功能
Show HN: Ferrite – Markdown editor in Rust with native Mermaid diagram rendering

原始链接: https://github.com/OlaProeis/Ferrite

## 铁氧体:一款轻量级原生编辑器 铁氧体是一个用 Rust 和 egui 构建的快速轻量级文本编辑器,专为 Markdown、JSON、YAML 和 TOML 文件设计。它主要为 Windows 开发,但也支持 Linux 和 macOS(测试较少)。 主要功能包括具有实时预览的所见即所得 Markdown 编辑器、用于结构化数据的树形视图、具有正则表达式的强大查找和替换功能,以及完整的撤销/重做功能。用户可以受益于拆分视图、禅模式、40 多种语言的语法高亮、代码折叠、小地图和括号匹配。 铁氧体支持工作区模式,具有文件树和快速切换器,以及显示文件状态的基本 Git 集成。它提供会话持久性、浅色和深色主题、文档大纲和导出为 HTML 的功能。高级功能包括用于 shell 命令的实时管道和原生图表渲染(流程图、序列图等)。 铁氧体可供 Windows、Linux 和 macOS 下载,优先考虑原生、响应迅速的体验,并提供可自定义设置,欢迎社区贡献。

## 铁氧体:一款新的基于 Rust 的 Markdown 编辑器 OlaProis 发布了铁氧体 0.2.1 版本,这是一款使用 Rust 和 egui 框架构建的快速 Markdown 编辑器。此版本的一个关键特性是**原生 Mermaid 图表渲染**——完全用 Rust 实现,无需 JavaScript 解释器,并提高了鲁棒性。 铁氧体还具有用于同时显示原始文本和渲染输出的分屏视图,40 多种语言的语法高亮显示,以及 JSON/YAML/TOML 文件的查看器。它包括 Git 集成以显示文件状态,以及诸如小地图、禅模式和自动保存等功能。 该编辑器是一个紧凑的 ~15MB 二进制文件,启动速度快,适用于 Windows、Linux 和 macOS。开发者正在寻求反馈,并计划在 v0.2.2 中进一步提高性能,尤其是在处理大文件时。用户指出它在日益充斥着 LLM 生成的、富含图表的文本领域具有潜力。
相关文章

原文

License: MIT Rust

A fast, lightweight text editor for Markdown, JSON, YAML, and TOML files. Built with Rust and egui for a native, responsive experience.

⚠️ Platform Note: Ferrite has been primarily developed and tested on Windows. While it should work on Linux and macOS, these platforms have not been extensively tested. If you encounter issues, please report them.

  • WYSIWYG Markdown Editing - Edit markdown with live preview, click-to-edit formatting, and syntax highlighting
  • Multi-Format Support - Native support for Markdown, JSON, YAML, and TOML files
  • Tree Viewer - Hierarchical view for JSON/YAML/TOML with inline editing, expand/collapse, and path copying
  • Find & Replace - Search with regex support and match highlighting
  • Undo/Redo - Full undo/redo support per tab
  • Split View - Side-by-side raw editor and rendered preview with resizable divider
  • Zen Mode - Distraction-free writing with centered text column
  • Sync Scrolling - Bidirectional scroll sync between raw and rendered views
  • Syntax Highlighting - Full-file syntax highlighting for 40+ languages (Rust, Python, JavaScript, Go, etc.)
  • Code Folding - Fold detection with gutter indicators (▶/▼) for headings, code blocks, and lists (text hiding deferred to v0.3.0)
  • Minimap - VS Code-style navigation panel with click-to-jump and search highlights
  • Bracket Matching - Highlight matching brackets ()[]{}<> and emphasis pairs ** __
  • Auto-Save - Configurable auto-save with temp-file safety
  • Line Numbers - Optional line number gutter

Native rendering of 11 diagram types directly in the preview:

  • Flowchart, Sequence, Pie, State, Mindmap
  • Class, ER, Git Graph, Gantt, Timeline, User Journey

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 for full details.

  • Workspace Mode - Open folders with file tree, quick switcher (Ctrl+P), and search-in-files (Ctrl+Shift+F)
  • Git Integration - Visual status indicators showing modified, added, untracked, and ignored files
  • Session Persistence - Restore open tabs, cursor positions, and scroll offsets on restart
  • Light & Dark Themes - Beautiful themes with runtime switching
  • Document Outline - Navigate large documents with the outline panel
  • Export Options - Export to HTML with themed styling, or copy as HTML
  • Formatting Toolbar - Quick access to bold, italic, headings, lists, links, and more
  • Live Pipeline - Pipe JSON/YAML content through shell commands (for developers)
  • Custom Window - Borderless window with custom title bar and resize handles

Download the latest release for your platform from GitHub Releases.

Platform Download
Windows ferrite-windows-x64.zip
Linux ferrite-editor_amd64.deb (recommended) or ferrite-linux-x64.tar.gz
macOS ferrite-macos-x64.tar.gz

Using .deb package (Debian/Ubuntu/Mint - Recommended):

# Download the .deb file, then install with:
sudo apt install ./ferrite-editor_amd64.deb

# Or using dpkg:
sudo dpkg -i ferrite-editor_amd64.deb

This will:

  • Install Ferrite to /usr/bin/ferrite
  • Add desktop entry (appears in your app menu)
  • Register file associations for .md, .json, .yaml, .toml files
  • Install icons for the system

Using tar.gz (any Linux distro):

tar -xzf ferrite-linux-x64.tar.gz
./ferrite
  • Rust 1.70+ - Install from rustup.rs
  • Platform-specific dependencies:

Windows:

  • Visual Studio Build Tools 2019+ with C++ workload

Linux:

# Ubuntu/Debian
sudo apt install build-essential pkg-config libgtk-3-dev libxcb-shape0-dev libxcb-xfixes0-dev

# Fedora
sudo dnf install gcc pkg-config gtk3-devel libxcb-devel

# Arch
sudo pacman -S base-devel pkg-config gtk3 libxcb

macOS:

# Clone the repository
git clone https://github.com/OlaProeis/Ferrite.git
cd Ferrite

# Build release version (optimized)
cargo build --release

# The binary will be at:
# Windows: target/release/ferrite.exe
# Linux/macOS: target/release/ferrite
# Run from source
cargo run --release

# Or run the binary directly
./target/release/ferrite

# Open a specific file
./target/release/ferrite path/to/file.md

# Open a folder as workspace
./target/release/ferrite path/to/folder/

Ferrite supports three view modes for Markdown files:

  • Raw - Plain text editing with syntax highlighting
  • Rendered - WYSIWYG editing with rendered markdown
  • Split - Side-by-side raw editor and live preview

Toggle between modes using the toolbar buttons or keyboard shortcuts.

Shortcut Action
Ctrl+N New file
Ctrl+O Open file
Ctrl+S Save file
Ctrl+Shift+S Save as
Ctrl+W Close tab
Shortcut Action
Ctrl+Tab Next tab
Ctrl+Shift+Tab Previous tab
Ctrl+P Quick file switcher (workspace)
Ctrl+Shift+F Search in files (workspace)
Shortcut Action
Ctrl+Z Undo
Ctrl+Y / Ctrl+Shift+Z Redo
Ctrl+F Find
Ctrl+H Find and replace
Ctrl+B Bold
Ctrl+I Italic
Ctrl+K Insert link
Shortcut Action
F11 Toggle fullscreen
Ctrl+, Open settings
Ctrl+Shift+[ Fold all
Ctrl+Shift+] Unfold all

Settings are stored in platform-specific locations:

  • Windows: %APPDATA%\ferrite\
  • Linux: ~/.config/ferrite/
  • macOS: ~/Library/Application Support/ferrite/

Workspace settings are stored in .ferrite/ within the workspace folder.

Access settings via Ctrl+, or the gear icon. Configure:

  • Appearance: Theme, font family, font size
  • Editor: Word wrap, line numbers, minimap, bracket matching, code folding, syntax highlighting
  • Files: Auto-save, recent files history

See ROADMAP.md for planned features and known issues.

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Quick Start for Contributors

# Fork and clone
git clone https://github.com/YOUR_USERNAME/Ferrite.git
cd Ferrite

# Create a feature branch
git checkout -b feature/your-feature

# Make changes, then verify
cargo fmt
cargo clippy
cargo test
cargo build

# Commit and push
git commit -m "feat: your feature description"
git push origin feature/your-feature
Component Technology
Language Rust 1.70+
GUI Framework egui 0.28 + eframe 0.28
Markdown Parser comrak 0.22
Syntax Highlighting syntect 5.1
Git Integration git2 0.19
File Dialogs rfd 0.14
Clipboard arboard 3
File Watching notify 6
Fuzzy Matching fuzzy-matcher 0.3

This project is licensed under the MIT License - see the LICENSE file for details.

联系我们 contact @ memedata.com