#etch

bin+lib etch

Not just a text formatter, don’t mark it down, etch it

4 releases (breaking)

✓ Uses Rust 2018 edition

0.4.0 Aug 30, 2019
0.3.0 Jul 11, 2019
0.2.0 Jun 4, 2019
0.1.0 May 26, 2019

#113 in Text processing

Download history 14/week @ 2019-05-24 14/week @ 2019-05-31 14/week @ 2019-06-07 3/week @ 2019-06-14 33/week @ 2019-06-21 7/week @ 2019-06-28 16/week @ 2019-07-05 12/week @ 2019-07-12 7/week @ 2019-07-19 3/week @ 2019-07-26 13/week @ 2019-08-02 8/week @ 2019-08-09 24/week @ 2019-08-23

52 downloads per month

MIT license

89KB
2.5K SLoC

Etch v0.4

Not just a text formatter, don't mark it down, etch it.

Syntax

  • Not too dissimilar from Markdown, simpler yet also more powerful:

    # My Document
    
    This is what etch text looks like!
    
    [a]
    You can tag entire blocks of text with a tag prefix, individual words[b]
    with a tag suffix, or [entire spans of text][b] using square brackets.
    
    #[a: .myClass]
    #[b: @alt surprise alt text!]
    #[c: @https://example.com]
    
    And lastly, tags can be declared when you first reference them[d: .nice]
    and the tag name is optional[.cool].
    
  • Documents can import other documents:

    #import[my-document.etch]
    

    Or other files as preformatted text:

    [css]
    #import[my-css-example.css]
    
  • Documents can contain custom metadata such as a title or description:

    #meta[title: My Document]
    
  • Plugin API allows for transforming documents or injecting custom parsers.

  • Code syntax highlighting provided by the Syntect plugin.

A more complete example of Etch syntax can be found in the samples directory.

Usage

use etch::Etch;
use etch::plugins::*;

fn main() {
    let metadata = MetadataPlugin::new();
    let word_count = WordCountPlugin::new();
    let etch = Etch::default()
        .with_plugin(metadata.clone())
        .with_plugin(word_count.clone())
        .with_plugin(SyntectPlugin::new())
        .with_plugin(WidowedWordsPlugin::new())
        .with_document("my_document.etch");

    println!("{:#?}", etch.render());
    println!("{:#?}", metadata);
    println!("{:#?}", word_count);
}

Dependencies

~1–1.7MB
~35K SLoC