1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// src/lib.rs
/// The `error` module contains error types for Markdown processing.
/// The `extensions` module contains custom block and table extensions.
/// Mermaid diagram rendering for fenced `mermaid` code blocks.
/// Syntax highlighting adapter for comrak's plugin system.
/// Validation primitives used by [`MarkdownOptions::validate`].
/// The `markdown` module contains the core processing pipeline.
// ── Re-exports ──────────────────────────────────────────────────────
pub use MarkdownError;
/// Applies syntax highlighting to code (standalone usage).
///
/// # Example
/// ```
/// use mdx_gen::apply_syntax_highlighting;
/// let highlighted = apply_syntax_highlighting("fn main() {}", "rust");
/// ```
pub use apply_syntax_highlighting;
/// Generates a CSS stylesheet for a built-in syntect theme so that
/// callers can render the class-based output produced by the
/// highlighter and the comrak adapter.
pub use theme_css;
pub use collect_headings;
pub use ColumnAlignment;
pub use CustomBlockConfig;
pub use CustomBlockType;
pub use Heading;
/// Structured validation error surfaced by
/// [`MarkdownOptions::validate`]. The pipeline folds failing checks
/// into [`MarkdownError::InvalidOptionsError`]; callers can inspect
/// the structured form directly before running the pipeline.
pub use ValidationError;
/// Builder that composes multiple validation checks into a single
/// pass — used internally by [`MarkdownOptions::validate`].
pub use Validator;
/// Script block that hydrates client-side `<pre class="mermaid">`
/// containers into inline SVG. Embed once per page — typically
/// before `</body>`.
pub use hydration_script_html;
/// Processes a Markdown string and converts it into HTML.
///
/// # Example
/// ```
/// use mdx_gen::{process_markdown, MarkdownOptions};
/// use comrak::Options;
///
/// let markdown_input = "# Hello, World!";
/// let mut comrak_options = Options::default();
/// comrak_options.extension.table = true;
///
/// let options = MarkdownOptions::default()
/// .with_custom_blocks(false)
/// .with_comrak_options(comrak_options);
///
/// let html_output = process_markdown(markdown_input, &options).expect("Failed to process markdown");
/// assert!(html_output.contains("<h1>Hello, World!</h1>"));
/// ```
///
/// # Errors
///
/// Returns a `MarkdownError` if options are invalid, input exceeds
/// the size limit, or rendering fails.
pub use process_markdown;
/// Streams processed HTML directly to a `Write` sink.
///
/// See [`process_markdown`] for the pipeline semantics; this variant
/// writes the output through a caller-provided writer instead of
/// allocating a `String`.
pub use process_markdown_to_writer;
/// Extracts plain-text content from Markdown (strips all formatting).
///
/// # Example
/// ```
/// use mdx_gen::{process_markdown_to_plain_text, MarkdownOptions};
/// let text = process_markdown_to_plain_text("# Hello\nWorld", &MarkdownOptions::default()).unwrap();
/// assert_eq!(text, "Hello World");
/// ```
pub use process_markdown_to_plain_text;
/// Processes Markdown and returns both the rendered HTML and a
/// document-order list of [`Heading`]s suitable for building a
/// table of contents.
pub use process_markdown_with_toc;
/// Streaming variant of [`process_markdown_with_toc`].
pub use process_markdown_with_toc_to_writer;
pub use MarkdownOptions;
pub use SanitizerConfig;
/// Re-export comrak's options for convenience.
///
/// # Usage
/// ```
/// use mdx_gen::Options;
///
/// let mut options = Options::default();
/// options.extension.strikethrough = true;
/// ```
pub use Options;