Crates.io | etch |
lib.rs | etch |
version | 0.4.2 |
source | src |
created_at | 2019-05-26 15:14:03.982546 |
updated_at | 2019-12-21 21:51:06.274019 |
description | Not just a text formatter, don't mark it down, etch it. |
homepage | |
repository | https://gitlab.com/glue-for-rust/etch-rs |
max_upload_size | |
id | 137155 |
size | 120,547 |
Not just a text formatter, don't mark it down, etch it.
# 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].
#import[my-document.etch]
Or other files as preformatted text:
[css]
#import[my-css-example.css]
#meta[title: My Document]
use etch::Etch;
use etch::plugins::*;
let word_count = WordCountPlugin::new();
let etch = Etch::default()
.with_plugin(word_count.clone())
.with_document("my_document.etch");
println!("{:#?}", word_count);
Enable the syntect-plugin
feature:
[dependencies]
etch = { version = "...", features = ["syntect-plugin"] }
And attach the plugin:
use etch::Etch;
use etch::plugins::*;
let etch = Etch::default()
.with_plugin(SyntectPlugin::new())
.with_document("my_document.etch");
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);
}