8 个不稳定版本 (3 个破坏性更新)
0.4.2 | 2019年12月21日 |
---|---|
0.4.0 |
|
0.3.2 | 2019年12月21日 |
0.3.0 |
|
#473 in 文本处理
每月61次下载
91KB
2.5K SLoC
Etch v0.4
不仅仅是一个文本格式化工具,不要只是标记它,etch 它。
语法
与Markdown相似,但更简单且更强大
# 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]
或将其他文件作为预格式化文本
[css]
#import[my-css-example.css]
文档可以包含自定义元数据,如标题或描述
#meta[title: My Document]
插件API允许转换文档或注入自定义解析器。
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);
代码语法高亮由Syntect插件提供。
启用 syntect-plugin
功能
[dependencies]
etch = { version = "...", features = ["syntect-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);
}
依赖项
~0.5–9.5MB
~73K SLoC