Skip to main content

Crate oak_highlight

Crate oak_highlight 

Source
Expand description

ยง๐Ÿ› ๏ธ Developer Guide

Syntax highlighting for the Oak language framework.

This crate provides a flexible syntax highlighting system with support for various exporters (HTML, ANSI, JSON, etc.) and themes.

This directory contains the core logic implementation of the project. Below are instructions for a quick start.

ยง๐Ÿšฆ Quick Start

ยงCore API Usage

// Example: Basic calling workflow
fn main() {
    // 1. Initialization
    // 2. Execute core logic
    // 3. Handle returned results
}

ยง๐Ÿ” Module Description

  • lib.rs: Exports public interfaces and core traits.
  • parser/ (if exists): Implements specific syntax parsing logic.
  • ast/ (if exists): Defines the syntax tree structure.

ยง๐Ÿ—๏ธ Architecture Design

The project follows the general architectural specifications of the Oak ecosystem, emphasizing:

  1. Immutability: Uses the Green/Red Tree structure to ensure efficient sharing of syntax trees.
  2. Fault Tolerance: Core logic is highly inclusive of erroneous input.
  3. Scalability: Convenient for downstream tools to perform secondary development.

Re-exportsยง

pub use crate::exporters::AnsiExporter;
pub use crate::exporters::CssExporter;
pub use crate::exporters::ExportFormat;
pub use crate::exporters::Exporter;
pub use crate::exporters::HtmlExporter;
pub use crate::exporters::JsonExporter;
pub use crate::highlighter::HighlightResult;
pub use crate::highlighter::HighlightSegment;
pub use crate::highlighter::HighlightSpan;
pub use crate::highlighter::HighlightStyle;
pub use crate::highlighter::HighlightTheme;
pub use crate::highlighter::Highlighter;
pub use crate::highlighter::OakHighlighter;
pub use crate::themes::Theme;

Modulesยง

exporters
Exporters for converting highlighted segments to different formats. Exporters for converting highlighted segments to different formats.
highlighter
Core highlighting logic and structures. Core highlighting logic and structures.
themes
Predefined themes and theme loading logic. Predefined themes and theme loading logic.