A Rust library for parsing orgmode files.
Find a file
2019-04-06 14:49:47 +08:00
benches chore: add license & rename to orgize 2019-02-06 19:49:44 +08:00
examples feat(parser): timestamp parsing 2019-04-05 21:02:10 +08:00
fuzz chore: add license & rename to orgize 2019-02-06 19:49:44 +08:00
src feat(parser): planning parsing 2019-04-06 14:49:47 +08:00
.gitignore update 2019-01-10 20:58:13 +08:00
.travis.yml chore: setup ci 2019-02-06 19:56:44 +08:00
Cargo.toml refactor(export): HtmlRender & HtmlHandler 2019-02-14 13:39:03 +08:00
LICENSE chore: add license & rename to orgize 2019-02-06 19:49:44 +08:00
README.md fix: typo wirter -> writer 2019-02-14 14:02:29 +08:00
STATUS.md feat: use bytecount for bytes counting 2019-02-13 15:59:18 +08:00

Orgize

Orgize is a Emacs Org-mode parser written by pure Rust. It behaves like a pull parser (returning an iterator of events) but not exactly.

Besides, orgize also provides some mechanism for exporting org-mode files to various formats, e.g. HTML.

Usage

[dependencies]
orgize = "0.1.0"
// Rust 2015 only
extern crate orgize;

Example

use orgize::Parser;

let parser = Parser::new(
    r"* Title 1
*Section 1*
** Title 2
_Section 2_
* Title 3
/Section 3/
* Title 4
=Section 4=",
);

for event in parser {
    // handling the event
}

Alternatively, you can use the built-in render.

use orgize::export::DefaultHtmlRender;
use std::io::Cursor;

let contents = r"* Title 1
*Section 1*
** Title 2
_Section 2_
* Title 3
/Section 3/
* Title 4
=Section 4=";

let cursor = Cursor::new(Vec::new());
let mut render = DefaultHtmlRender::new(cursor, &contents);

render
    .render()
    .expect("something went wrong rendering the file");
    
let result = String::from_utf8(render.into_writer().into_inner()).expect("invalid utf-8");

License

MIT