org_rust_exporter/lib.rs
1//! Exporter for Org-Mode documents
2//!
3//! This crate exposes the [`Exporter`] trait, which each backend must implement.
4//!
5//! # Examples
6//!
7//! To convert an input string to HTML/Org, just invoke [`Exporter::export`]:
8//!
9//! ```rust
10//! use org_rust_exporter as org_exporter;
11//! use org_exporter::{Html, Org, Exporter, ConfigOptions};
12//!
13//! let html_str: String = Html::export("* Hello HTML!\n", ConfigOptions::default()).unwrap();
14//! let org_str: String = Org::export("* Hello Org!\n", ConfigOptions::default()).unwrap();
15//! ```
16//!
17//! You can also export into a buffer that implements [`fmt::Write`]:
18//!
19//! ```rust
20//! use org_rust_exporter as org_exporter;
21//! use org_exporter::{Html, Org, Exporter, ConfigOptions};
22//!
23//! let mut html_str = String::new();
24//! let mut org_str = String::new();
25//!
26//! Html::export_buf("* Hello HTML!\n", &mut html_str, ConfigOptions::default());
27//! Org::export_buf("* Hello Org!\n", &mut org_str, ConfigOptions::default());
28//!
29//! assert_eq!(html_str, r#"<h1 id="hello-html">Hello HTML!</h1>
30//! "#);
31//! assert_eq!(org_str, "* Hello Org!\n");
32//! ```
33
34mod html;
35mod include;
36mod org;
37mod org_macros;
38mod types;
39mod utils;
40
41pub use html::Html;
42pub use org::Org;
43pub use types::{ConfigOptions, ExportError, Exporter};