#![deny(clippy::undocumented_unsafe_blocks)]
pub mod ast;
mod block;
mod entities;
pub mod ffi;
mod html;
mod inline;
mod render;
pub use ast::{Block, ListKind, TableAlignment, TableData};
pub use block::{parse, parse_to_ast};
#[inline(always)]
pub(crate) fn is_ascii_punctuation(b: u8) -> bool {
matches!(b, b'!'..=b'/' | b':'..=b'@' | b'['..=b'`' | b'{'..=b'~')
}
#[inline(always)]
pub(crate) fn utf8_char_len(first: u8) -> usize {
if first < 0x80 {
1
} else if first < 0xE0 {
2
} else if first < 0xF0 {
3
} else {
4
}
}
pub struct ParseOptions {
pub hard_breaks: bool,
pub enable_highlight: bool,
pub enable_strikethrough: bool,
pub enable_underline: bool,
pub enable_tables: bool,
pub enable_autolink: bool,
pub enable_task_lists: bool,
pub disable_raw_html: bool,
pub max_nesting_depth: usize,
pub max_input_size: usize,
}
impl Default for ParseOptions {
fn default() -> Self {
Self {
hard_breaks: true,
enable_highlight: true,
enable_strikethrough: true,
enable_underline: true,
enable_tables: true,
enable_autolink: true,
enable_task_lists: true,
disable_raw_html: false,
max_nesting_depth: 128,
max_input_size: 0,
}
}
}