#org-mode #exporter #document #convert #html #export

org-rust-exporter

exporter for org mode documents parsed with org-rust-parser

8 releases

new 0.1.8 Nov 26, 2024
0.1.6 Jun 8, 2024
0.1.5 May 29, 2024
0.1.2 Apr 11, 2024
0.1.1 Jul 11, 2023

#5 in #org-mode

Download history 3/week @ 2024-09-12 13/week @ 2024-09-19 12/week @ 2024-09-26 3/week @ 2024-10-03 68/week @ 2024-11-21

68 downloads per month
Used in org-rust

MIT license

390KB
12K SLoC

Exporter for Org-Mode documents

This crate exposes the Exporter trait, which each backend must implement.

Examples

To convert an input string to HTML/Org, just invoke Exporter::export:

use org_rust_exporter as org_exporter;
use org_exporter::{Html, Org, Exporter, ConfigOptions};

let html_str: String = Html::export("* Hello HTML!\n", ConfigOptions::default()).unwrap();
let org_str: String = Org::export("* Hello Org!\n", ConfigOptions::default()).unwrap();

You can also export into a buffer that implements fmt::Write:

use org_rust_exporter as org_exporter;
use org_exporter::{Html, Org, Exporter, ConfigOptions};

let mut html_str = String::new();
let mut org_str = String::new();

Html::export_buf("* Hello HTML!\n", &mut html_str, ConfigOptions::default());
Org::export_buf("* Hello Org!\n", &mut org_str, ConfigOptions::default());

assert_eq!(html_str, r#"<h1 id="hello-html">Hello HTML!</h1>
"#);
assert_eq!(org_str, "* Hello Org!\n");

Dependencies

~3–5MB
~87K SLoC