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
//! Tier-1 single-pass byte scanner.
//!
//! Walks `html.as_bytes()` once and emits Markdown directly to a pre-sized
//! output buffer. On any construct it cannot handle exactly, returns a
//! [`BailReason`] so the dispatcher can fall back to Tier-2.
//!
//! # Supported subset (M9 + Phase E + Phase I)
//!
//! Paragraph, Heading(1-6), Strong, Emphasis, Code (inline), Pre, Hr,
//! `LineBreak`, Link, Image, List(Unordered), List(Ordered), `ListItem`,
//! Blockquote, Block (div/section/article/center/etc.), Inline (span/etc.),
//! Table (GFM — conservative bail set, inline-only cell content),
//! SVG (emitted as base64 data URI — Phase I), and custom elements (tag names
//! containing `-`, treated as Block containers).
//!
//! Bails on: RawText(script/style/textarea/etc.), `DefinitionTerm`,
//! `DefinitionDescription`, List(Definition), Ignored (head/meta/link),
//! nested tables, non-inlineable block children in cells (heading/list/blockquote/pre),
//! section-order violations, and any HTML construct with in-text whitespace
//! complexity or unclosed tags.
use cratehas_uri_scheme;
use crateBailReason;
use crateparse;
use cratespec_rules;
use crate;
use crate;
use crate;
use crateNAV_KEYWORDS;
use crateConversionOptions;
use crateReferenceContext;
use ;
/// Maximum byte length of a tag name lowercased into a stack buffer.
///
/// Names longer than this are silently truncated and will not match any
/// entry in the spec table, causing an `UnknownCustomElement` bail.
const MAX_TAG_NAME_BYTES: usize = 32;
/// Minimum number of dashes in a GFM separator cell.
///
/// Matches Tier-2's `col_widths.get(i).unwrap_or(0).max(MIN_SEPARATOR_DASHES)`.
const MIN_SEPARATOR_DASHES: usize = 3;
/// Minimum length of a Markdown code fence (```` ``` ````) per `CommonMark`.
///
/// ~keep Mirrors `converter::handlers::code_block::MIN_FENCE_LENGTH`. Not imported
/// from there: that module is owned by another concurrent edit lane and this
/// crate's `tier1/` ownership boundary forbids editing it to add a `pub(crate)`
/// re-export. Reported as a proposed shared-helper extraction (see module docs).
const MIN_FENCE_LENGTH: usize = 3;
/// Static `TagSpec` used for all unknown custom elements (tag names containing
/// `-`, e.g. `<x-foo>`, `<my-component>`).
///
/// ~keep Unknown/custom elements are inline by default in HTML (there is no
/// such thing as a block-level custom element absent a UA stylesheet
/// rule or CSS `display` override, neither of which this converter
/// applies) and Tier-2's DOM walk treats them exactly that way: an
/// `<x-widget>` inside flowing text stays inline in the surrounding
/// paragraph/list-item/blockquote instead of splitting it. A `Block`
/// spec here previously matched Tier-2 only for the common case of a
/// custom element as a whole top-level document/child; it diverged the
/// moment one appeared inline.
///
/// The static reference `&CUSTOM_ELEMENT_INLINE_SPEC` is used anywhere the
/// scanner needs a `&'static TagSpec` for a custom element open/close tag.
static CUSTOM_ELEMENT_INLINE_SPEC: TagSpec = TagSpec ;
/// ATX heading prefixes indexed by level − 1 (0 = `h1`, 5 = `h6`).
const HEADING_PREFIXES: = ;
/// List-item indentation strings indexed by depth (0 = top-level, no indent).
///
/// Depths beyond the table size fall back to a runtime allocation.
const LIST_ITEM_INDENTS: = ;
/// Successful output of the Tier-1 scanner.
include!;
include!;
include!;
include!;
include!;
include!;
include!;
include!;
include!;