#![deny(
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unstable_features,
unused_import_braces
)]
#![allow(unknown_lints, clippy::doc_markdown, cyclomatic_complexity)]
extern crate entities;
extern crate pest;
#[macro_use]
extern crate pest_derive;
extern crate memchr;
#[cfg(test)]
extern crate ntest;
extern crate once_cell;
#[cfg(all(test, not(target_arch = "wasm32")))]
extern crate propfuzz;
extern crate regex;
#[cfg(feature = "syntect")]
extern crate syntect;
#[cfg(feature = "benchmarks")]
extern crate test;
extern crate typed_arena;
extern crate unicode_categories;
pub mod adapters;
pub mod arena_tree;
mod cm;
mod ctype;
mod entity;
mod html;
pub mod nodes;
mod parser;
pub mod plugins;
mod scanners;
mod strings;
#[cfg(test)]
mod tests;
pub use cm::format_document as format_commonmark;
pub use cm::format_document_with_plugins as format_commonmark_with_plugins;
pub use html::format_document as format_html;
pub use html::format_document_with_plugins as format_html_with_plugins;
pub use html::Anchorizer;
pub use parser::{
parse_document, parse_document_with_broken_link_callback, ComrakExtensionOptions,
ComrakOptions, ComrakParseOptions, ComrakPlugins, ComrakRenderOptions, ComrakRenderPlugins,
ListStyleType,
};
pub use typed_arena::Arena;
pub fn markdown_to_html(md: &str, options: &ComrakOptions) -> String {
markdown_to_html_with_plugins(md, options, &ComrakPlugins::default())
}
pub fn markdown_to_html_with_plugins(
md: &str,
options: &ComrakOptions,
plugins: &ComrakPlugins,
) -> String {
let arena = Arena::new();
let root = parse_document(&arena, md, options);
let mut s = Vec::new();
format_html_with_plugins(root, options, &mut s, plugins).unwrap();
String::from_utf8(s).unwrap()
}
pub fn version() -> &'static str {
env!("CARGO_PKG_VERSION")
}
pub fn markdown_to_commonmark(md: &str, options: &ComrakOptions) -> String {
let arena = Arena::new();
let root = parse_document(&arena, md, options);
let mut s = Vec::new();
format_commonmark(root, options, &mut s).unwrap();
String::from_utf8(s).unwrap()
}