#![no_std]
#![deny(clippy::pedantic)]
#![allow(clippy::doc_link_with_quotes)]
#![allow(clippy::missing_panics_doc)]
#![allow(clippy::must_use_candidate)]
#![allow(clippy::too_many_lines)]
#![allow(clippy::result_large_err)]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/wooorm/markdown-rs/8924580/media/logo-monochromatic.svg?sanitize=true"
)]
extern crate alloc;
mod align_kind;
mod block_parser;
mod byte_scan;
mod code_fence;
mod configuration;
mod definitions;
mod document;
mod event_html_renderer;
mod event_parser;
mod headings;
mod inline_parser;
pub mod markdown;
mod node_syntax;
mod reference_kind;
pub mod stream;
mod util;
mod value_builder;
pub mod message;
#[doc(hidden)]
pub use util::sanitize_uri::sanitize;
pub use util::line_ending::LineEnding;
pub use align_kind::AlignKind;
pub use code_fence::CodeFence;
pub use configuration::{CompileOptions, Constructs, Options, ParseOptions};
pub use document::{
AstBuilder, BuildProgress, Children, Descendants, Document, DocumentEvents,
Node as DocumentNode, NodeId,
};
pub use event_html_renderer::{render_events, EventHtmlRenderer};
pub use event_parser::EventParser;
pub use headings::{HeadingEntry, HeadingOptions};
pub use markdown::to_markdown_node;
pub use markdown::{to_markdown, to_markdown_with_options};
pub use markdown::{IndentOptions, LineWrapping, Options as MarkdownOptions};
pub use node_syntax::NodeSyntax;
pub use reference_kind::ReferenceKind;
use alloc::string::String;
pub fn to_html(value: &str) -> String {
to_html_with_options(value, &Options::default())
}
pub fn to_html_with_options(value: &str, options: &Options) -> String {
let mut output = String::with_capacity(value.len().min(4096));
let result = EventHtmlRenderer::new(value, &options.compile, &mut output)
.render_markdown(&options.parse);
match result {
Ok(()) => output,
Err(_) => unreachable!(
"parser events are balanced and source-valid; writing to String cannot fail"
),
}
}