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
//! Tier-1: single-pass byte-scanner conversion path.
//!
//! `run` delegates to the byte scanner in `scanner.rs`. When the scanner
//! encounters a construct it cannot handle, it returns `Err(BailReason::*)`
//! and the dispatcher in `lib.rs::convert` falls back to the Tier-2 path.
//!
//! When `options.extract_metadata` is true, `run` additionally re-parses the
//! head slice captured by the prescan and prepends YAML frontmatter to the
//! scanner's output (matching Tier-2 behaviour byte-for-byte).
// ~keep All submodules are declared `pub` here. The `tier1` module itself lives
// ~keep inside `pub(crate) mod converter`, so the effective visibility is already
// ~keep crate-internal; `pub(crate)` would be redundant and triggers the
// ~keep `clippy::redundant_pub_crate` lint. The `tier1` module is only re-exported
// ~keep from `lib.rs` under `#[cfg(any(test, feature = "testkit"))]`, so these
// ~keep submodules remain invisible outside the crate in normal builds.
// ~keep `lookup` is called by scanner.rs as `tier1::lookup(...)`.
pub use lookup;
// ~keep `BailReason` re-export for testkit/bench consumers who pattern-match on it.
// ~keep Not needed by production code (convert_api.rs discards the bail value), so
// ~keep gate it to avoid widening the non-testkit API surface.
pub use BailReason;
// ~keep Convenience re-exports for testkit consumers that import via
// ~keep `html_to_markdown_rs::tier1::{ListKind, TagKind, …}` rather than the full
// ~keep module path.
pub use ;
// ~keep `RouterDecision` is compared in production code (convert_api.rs line 82)
// ~keep via the path `tier1::RouterDecision::Tier1`, so this re-export is ungated.
pub use RouterDecision;
use cratePrescanReport;
use crateConversionOptions;
/// Attempt a Tier-1 conversion.
///
/// Returns the complete output string (optional YAML frontmatter followed by
/// the markdown body) on success, or `Err(BailReason::*)` when the scanner
/// encounters a construct it cannot handle. The dispatcher falls back to
/// Tier-2 transparently.
///
/// # Errors
///
/// Returns `Err(BailReason::*)` when the scanner encounters a construct it
/// cannot handle. The dispatcher falls back to Tier-2 transparently.
///
/// ~keep Kept at this exact 3-argument signature: it is re-exported (gated on
/// ~keep `test`/`testkit`) as `html_to_markdown_rs::tier1::run` and called directly by
/// ~keep dozens of integration tests under `tests/`. `convert_api.rs`'s production path
/// ~keep needs to pass a resolved `base_url` through to the scanner, which those tests
/// ~keep have no reason to exercise -- so that need is served by
/// ~keep [`run_with_base`] instead of widening this signature.
/// Run Tier-1 with caller-resolved URL context.
///
/// This is the same as [`run`], but resolves relative `href`/`src` destinations against
/// `effective_base` (see `converter::url_resolve::resolve_attribute_url`) and takes the
/// document's `<base href>` from the caller. Used by `convert_api.rs`'s production
/// conversion path.
///
/// # Errors
///
/// Returns `Err(BailReason::*)` when the scanner encounters a construct it cannot
/// handle. The dispatcher falls back to Tier-2 transparently.