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
//! Named pipeline stages that prepare a document for the layout passes.
//!
//! [`super::process_stream_inner`] calls these in the order the stages must
//! run, so the orchestration reads as a sequence rather than as one long body.
//! They live in their own module so the parent module stays within the
//! repository size limit, as [`super::buffer`] does.
use ;
use crate::;
/// Normalizes code fences when `opts.fences` is set.
///
/// Compression runs first, and orphan specifiers are attached to the compressed
/// blocks. A document that does not request fence handling is copied instead,
/// so every caller owns its input.
pub
/// Rewrites the footnote reference markers that the later passes measure.
///
/// Footnote references rewrite text, so they must be rewritten before the
/// passes that measure it. A reference such as `docs.1` grows into
/// `docs.[^1]`, and [`walk_fences_and_tables`] lays a cell out from the text it
/// can see, so converting afterwards leaves the cell wider than the delimiter
/// row that was measured from it. A body cell reading `see docs.1` produced a
/// delimiter row of ten dashes on the first pass and of thirteen on the second,
/// and the two never agreed.
///
/// Renumbering the labels belongs here too, for the same reason: a label
/// narrows, because `[^10]` becomes `[^1]` once the distinct references are
/// numbered by first encounter. Renumbering after the wrap measured the longer
/// label left a line that the next pass rejoined, since `[^1]` fits where
/// `[^10]` did not.
///
/// The inline half is told whether the heading pass will run, and leaves the
/// text that pass will read as a Setext heading alone.
///
/// The label half's scan reaches further than its name suggests. A trailing
/// list item that a reference points at is promoted to a definition header in
/// the same scan, because the two are matched by the number they share (a
/// reference ending `.3` and the item `3.` are one footnote), and the header is
/// a longer marker than the item's own, so it has to be written before the wrap
/// measures the line as well.
///
/// Only the block half waits for the layout, and
/// [`super::process_stream_inner`] runs it there.
pub
/// Buffers `pre` through the fence tracker and the table buffer, reflowing
/// every table it finds.
///
/// Returns the buffered output and the lines that belong to a table, which the
/// code-emphasis pass protects from the non-table repair. Code-emphasis and
/// ellipsis both shorten table cells, so they run inside the buffer, before
/// reflow measures column widths. Non-table text remains for the passes that
/// run after the walk.
pub