asciidoc-parser 0.19.0

Parser for AsciiDoc format
Documentation
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
use crate::{document::RefType, tests::prelude::*};

track_file!("ref/asciidoc-lang/docs/modules/sections/pages/titles-and-levels.adoc");

non_normative!(
    r#"
= Section Titles and Levels

Sections partition the document into a content hierarchy.
A section is an implicit enclosure.
Each section begins with a title and ends at the next sibling section, ancestor section, or end of document.
Nested section levels must be sequential.
A section can be a child of a document or another section, but it cannot be the child of any other block (i.e., you cannot put a section inside of a delimited block or list).

"#
);

#[test]
fn section_level_syntax() {
    non_normative!(
        r#"
== Section level syntax

"#
    );

    verifies!(
        r#"
A section title marks the beginning of a section and also acts as the heading for that section.
The section title must be prefixed with a section marker, which indicates the section level.
The number of equal signs in the marker represents the section level using a 0-based index (e.g., two equal signs represents level 1).
A section marker can range from two to six equal signs and must be followed by a space.

IMPORTANT: The section title line is interpreted as paragraph text if it's found inside of a non-section block unless it marked as a xref:blocks:discrete-headings.adoc[discrete heading].

In the HTML output, the section title is represented by a heading tag.
The number of the heading tag is one more than the section level (e.g., section level 1 becomes an h2 tag).
The section level ranges from 0-5.
This limit was established primarily due to the fact that HTML only provides heading tags from h1 to h6 (making level 5 the upper limit).

.Section titles available in an article doctype
[source]
----
include::example$section.adoc[tag=base]
----

The section titles are rendered as:

====
include::example$section.adoc[tag=b-base]
====

"#
    );

    let doc = Parser::default().parse("= Document Title (Level 0)\n\n== Level 1 Section Title\n\n=== Level 2 Section Title\n\n==== Level 3 Section Title\n\n===== Level 4 Section Title\n\n====== Level 5 Section Title\n\n== Another Level 1 Section Title");

    assert_eq!(
        doc,
        Document {
            header: Header {
                title_source: Some(Span {
                    data: "Document Title (Level 0)",
                    line: 1,
                    col: 3,
                    offset: 2,
                },),
                title: Some("Document Title (Level 0)",),
                attributes: &[],
                author_line: None,
                revision_line: None,
                comments: &[],
                source: Span {
                    data: "= Document Title (Level 0)",
                    line: 1,
                    col: 1,
                    offset: 0,
                },
            },
            blocks: &[
                Block::Section(SectionBlock {
                    level: 1,
                    section_title: Content {
                        original: Span {
                            data: "Level 1 Section Title",
                            line: 3,
                            col: 4,
                            offset: 31,
                        },
                        rendered: "Level 1 Section Title",
                    },
                    blocks: &[Block::Section(SectionBlock {
                        level: 2,
                        section_title: Content {
                            original: Span {
                                data: "Level 2 Section Title",
                                line: 5,
                                col: 5,
                                offset: 58,
                            },
                            rendered: "Level 2 Section Title",
                        },
                        blocks: &[Block::Section(SectionBlock {
                            level: 3,
                            section_title: Content {
                                original: Span {
                                    data: "Level 3 Section Title",
                                    line: 7,
                                    col: 6,
                                    offset: 86,
                                },
                                rendered: "Level 3 Section Title",
                            },
                            blocks: &[Block::Section(SectionBlock {
                                level: 4,
                                section_title: Content {
                                    original: Span {
                                        data: "Level 4 Section Title",
                                        line: 9,
                                        col: 7,
                                        offset: 115,
                                    },
                                    rendered: "Level 4 Section Title",
                                },
                                blocks: &[Block::Section(SectionBlock {
                                    level: 5,
                                    section_title: Content {
                                        original: Span {
                                            data: "Level 5 Section Title",
                                            line: 11,
                                            col: 8,
                                            offset: 145,
                                        },
                                        rendered: "Level 5 Section Title",
                                    },
                                    blocks: &[],
                                    source: Span {
                                        data: "====== Level 5 Section Title",
                                        line: 11,
                                        col: 1,
                                        offset: 138,
                                    },
                                    title_source: None,
                                    title: None,
                                    anchor: None,
                                    anchor_reftext: None,
                                    attrlist: None,
                                    section_type: SectionType::Normal,
                                    section_id: Some("_level_5_section_title"),
                                    caption: None,
                                    section_number: None,
                                },),],
                                source: Span {
                                    data: "===== Level 4 Section Title\n\n====== Level 5 Section Title",
                                    line: 9,
                                    col: 1,
                                    offset: 109,
                                },
                                title_source: None,
                                title: None,
                                anchor: None,
                                anchor_reftext: None,
                                attrlist: None,
                                section_type: SectionType::Normal,
                                section_id: Some("_level_4_section_title"),
                                caption: None,
                                section_number: None,
                            },),],
                            source: Span {
                                data: "==== Level 3 Section Title\n\n===== Level 4 Section Title\n\n====== Level 5 Section Title",
                                line: 7,
                                col: 1,
                                offset: 81,
                            },
                            title_source: None,
                            title: None,
                            anchor: None,
                            anchor_reftext: None,
                            attrlist: None,
                            section_type: SectionType::Normal,
                            section_id: Some("_level_3_section_title"),
                            caption: None,
                            section_number: None,
                        },),],
                        source: Span {
                            data: "=== Level 2 Section Title\n\n==== Level 3 Section Title\n\n===== Level 4 Section Title\n\n====== Level 5 Section Title",
                            line: 5,
                            col: 1,
                            offset: 54,
                        },
                        title_source: None,
                        title: None,
                        anchor: None,
                        anchor_reftext: None,
                        attrlist: None,
                        section_type: SectionType::Normal,
                        section_id: Some("_level_2_section_title"),
                        caption: None,
                        section_number: None,
                    },),],
                    source: Span {
                        data: "== Level 1 Section Title\n\n=== Level 2 Section Title\n\n==== Level 3 Section Title\n\n===== Level 4 Section Title\n\n====== Level 5 Section Title",
                        line: 3,
                        col: 1,
                        offset: 28,
                    },
                    title_source: None,
                    title: None,
                    anchor: None,
                    anchor_reftext: None,
                    attrlist: None,
                    section_type: SectionType::Normal,
                    section_id: Some("_level_1_section_title"),
                    caption: None,
                    section_number: None,
                },),
                Block::Section(SectionBlock {
                    level: 1,
                    section_title: Content {
                        original: Span {
                            data: "Another Level 1 Section Title",
                            line: 13,
                            col: 4,
                            offset: 171,
                        },
                        rendered: "Another Level 1 Section Title",
                    },
                    blocks: &[],
                    source: Span {
                        data: "== Another Level 1 Section Title",
                        line: 13,
                        col: 1,
                        offset: 168,
                    },
                    title_source: None,
                    title: None,
                    anchor: None,
                    anchor_reftext: None,
                    attrlist: None,
                    section_type: SectionType::Normal,
                    section_id: Some("_another_level_1_section_title"),
                    caption: None,
                    section_number: None,
                },),
            ],
            source: Span {
                data: "= Document Title (Level 0)\n\n== Level 1 Section Title\n\n=== Level 2 Section Title\n\n==== Level 3 Section Title\n\n===== Level 4 Section Title\n\n====== Level 5 Section Title\n\n== Another Level 1 Section Title",
                line: 1,
                col: 1,
                offset: 0,
            },
            warnings: &[],
            source_map: SourceMap(&[]),
            catalog: Catalog {
                refs: HashMap::from([
                    (
                        "_level_2_section_title",
                        RefEntry {
                            id: "_level_2_section_title",
                            reftext: Some("Level 2 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_level_4_section_title",
                        RefEntry {
                            id: "_level_4_section_title",
                            reftext: Some("Level 4 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_another_level_1_section_title",
                        RefEntry {
                            id: "_another_level_1_section_title",
                            reftext: Some("Another Level 1 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_level_3_section_title",
                        RefEntry {
                            id: "_level_3_section_title",
                            reftext: Some("Level 3 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_level_1_section_title",
                        RefEntry {
                            id: "_level_1_section_title",
                            reftext: Some("Level 1 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_level_5_section_title",
                        RefEntry {
                            id: "_level_5_section_title",
                            reftext: Some("Level 5 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                ]),
                reftext_to_id: HashMap::from([
                    ("Level 3 Section Title", "_level_3_section_title"),
                    ("Level 1 Section Title", "_level_1_section_title"),
                    ("Level 5 Section Title", "_level_5_section_title"),
                    ("Level 4 Section Title", "_level_4_section_title"),
                    (
                        "Another Level 1 Section Title",
                        "_another_level_1_section_title"
                    ),
                    ("Level 2 Section Title", "_level_2_section_title"),
                ]),
            },
        }
    );
}

// TODO (https://github.com/asciidoc-rs/asciidoc-parser/issues/380):
// Option to support multiple level-0 headings.
// Ignoring this rule for now.
non_normative!(
    r#"
Section levels must be nested logically.
There are two rules you must follow:

. A document can only have multiple level 0 sections if the `doctype` is set to `book`.
 ** The first level 0 section is the document title; subsequent level 0 sections represent parts.
"#
);

#[test]
fn section_levels_cant_be_skipped() {
    verifies!(
        r#"
. Section levels cannot be skipped when nesting sections (e.g., you can't nest a level 5 section directly inside a level 3 section; an intermediary level 4 section is required).

For example, the following syntax is illegal:

[source]
----
include::example$section.adoc[tag=bad]
----

Content above the first section title is designated as the document's preamble.
Once the first section title is reached, content is associated with the section it is nested in.

[source]
----
include::example$section.adoc[tag=content]
----

"#
    );

    let doc = Parser::default().parse("= Document Title\n\n= Illegal Level 0 Section (violates rule #1)\n\n== First Section\n\n==== Illegal Nested Section (violates rule #2)");

    assert_eq!(
        Document {
            header: Header {
                title_source: Some(Span {
                    data: "Document Title",
                    line: 1,
                    col: 3,
                    offset: 2,
                },),
                title: Some("Document Title",),
                attributes: &[],
                author_line: None,
                revision_line: None,
                comments: &[],
                source: Span {
                    data: "= Document Title",
                    line: 1,
                    col: 1,
                    offset: 0,
                },
            },
            blocks: &[
                Block::Preamble(Preamble {
                    blocks: &[Block::Simple(SimpleBlock {
                        content: Content {
                            original: Span {
                                data: "= Illegal Level 0 Section (violates rule #1)",
                                line: 3,
                                col: 1,
                                offset: 18,
                            },
                            rendered: "= Illegal Level 0 Section (violates rule #1)",
                        },
                        source: Span {
                            data: "= Illegal Level 0 Section (violates rule #1)",
                            line: 3,
                            col: 1,
                            offset: 18,
                        },
                        style: SimpleBlockStyle::Paragraph,
                        title_source: None,
                        title: None,
                        caption: None,
                        number: None,
                        anchor: None,
                        anchor_reftext: None,
                        attrlist: None,
                    },),],
                    source: Span {
                        data: "= Illegal Level 0 Section (violates rule #1)",
                        line: 3,
                        col: 1,
                        offset: 18,
                    },
                },),
                Block::Section(SectionBlock {
                    level: 1,
                    section_title: Content {
                        original: Span {
                            data: "First Section",
                            line: 5,
                            col: 4,
                            offset: 67,
                        },
                        rendered: "First Section",
                    },
                    blocks: &[Block::Section(SectionBlock {
                        level: 3,
                        section_title: Content {
                            original: Span {
                                data: "Illegal Nested Section (violates rule #2)",
                                line: 7,
                                col: 6,
                                offset: 87,
                            },
                            rendered: "Illegal Nested Section (violates rule #2)",
                        },
                        blocks: &[],
                        source: Span {
                            data: "==== Illegal Nested Section (violates rule #2)",
                            line: 7,
                            col: 1,
                            offset: 82,
                        },
                        title_source: None,
                        title: None,
                        anchor: None,
                        anchor_reftext: None,
                        attrlist: None,
                        section_type: SectionType::Normal,
                        section_id: Some("_illegal_nested_section_violates_rule_2"),
                        caption: None,
                        section_number: None,
                    },),],
                    source: Span {
                        data: "== First Section\n\n==== Illegal Nested Section (violates rule #2)",
                        line: 5,
                        col: 1,
                        offset: 64,
                    },
                    title_source: None,
                    title: None,
                    anchor: None,
                    anchor_reftext: None,
                    attrlist: None,
                    section_type: SectionType::Normal,
                    section_id: Some("_first_section"),
                    caption: None,
                    section_number: None,
                },),
            ],
            source: Span {
                data: "= Document Title\n\n= Illegal Level 0 Section (violates rule #1)\n\n== First Section\n\n==== Illegal Nested Section (violates rule #2)",
                line: 1,
                col: 1,
                offset: 0,
            },
            warnings: &[
                Warning {
                    source: Span {
                        data: "= Illegal Level 0 Section (violates rule #1)",
                        line: 3,
                        col: 1,
                        offset: 18,
                    },
                    warning: WarningType::Level0SectionHeadingNotSupported,
                },
                Warning {
                    source: Span {
                        data: "==== Illegal Nested Section (violates rule #2)",
                        line: 7,
                        col: 1,
                        offset: 82,
                    },
                    warning: WarningType::SectionHeadingLevelSkipped(1, 3,),
                },
            ],
            source_map: SourceMap(&[]),
            catalog: Catalog {
                refs: HashMap::from([
                    (
                        "_first_section",
                        RefEntry {
                            id: "_first_section",
                            reftext: Some("First Section",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_illegal_nested_section_violates_rule_2",
                        RefEntry {
                            id: "_illegal_nested_section_violates_rule_2",
                            reftext: Some("Illegal Nested Section (violates rule #2)",),
                            ref_type: RefType::Section,
                        }
                    ),
                ]),
                reftext_to_id: HashMap::from([
                    ("First Section", "_first_section"),
                    (
                        "Illegal Nested Section (violates rule #2)",
                        "_illegal_nested_section_violates_rule_2"
                    ),
                ]),
            },
        },
        doc
    );
}

#[test]
fn markdown_style() {
    verifies!(
        r#"
TIP: In addition to the equals sign marker used for defining section titles, Asciidoctor recognizes the hash symbol (`#`) from Markdown.
That means the outline of a Markdown document will be converted just fine as an AsciiDoc document.

"#
    );

    let doc = Parser::default().parse("= Document Title (Level 0)\n\n## Level 1 Section Title\n\n### Level 2 Section Title\n\n#### Level 3 Section Title\n\n##### Level 4 Section Title\n\n###### Level 5 Section Title\n\n## Another Level 1 Section Title");

    assert_eq!(
        doc,
        Document {
            header: Header {
                title_source: Some(Span {
                    data: "Document Title (Level 0)",
                    line: 1,
                    col: 3,
                    offset: 2,
                },),
                title: Some("Document Title (Level 0)",),
                attributes: &[],
                author_line: None,
                revision_line: None,
                comments: &[],
                source: Span {
                    data: "= Document Title (Level 0)",
                    line: 1,
                    col: 1,
                    offset: 0,
                },
            },
            blocks: &[
                Block::Section(SectionBlock {
                    level: 1,
                    section_title: Content {
                        original: Span {
                            data: "Level 1 Section Title",
                            line: 3,
                            col: 4,
                            offset: 31,
                        },
                        rendered: "Level 1 Section Title",
                    },
                    blocks: &[Block::Section(SectionBlock {
                        level: 2,
                        section_title: Content {
                            original: Span {
                                data: "Level 2 Section Title",
                                line: 5,
                                col: 5,
                                offset: 58,
                            },
                            rendered: "Level 2 Section Title",
                        },
                        blocks: &[Block::Section(SectionBlock {
                            level: 3,
                            section_title: Content {
                                original: Span {
                                    data: "Level 3 Section Title",
                                    line: 7,
                                    col: 6,
                                    offset: 86,
                                },
                                rendered: "Level 3 Section Title",
                            },
                            blocks: &[Block::Section(SectionBlock {
                                level: 4,
                                section_title: Content {
                                    original: Span {
                                        data: "Level 4 Section Title",
                                        line: 9,
                                        col: 7,
                                        offset: 115,
                                    },
                                    rendered: "Level 4 Section Title",
                                },
                                blocks: &[Block::Section(SectionBlock {
                                    level: 5,
                                    section_title: Content {
                                        original: Span {
                                            data: "Level 5 Section Title",
                                            line: 11,
                                            col: 8,
                                            offset: 145,
                                        },
                                        rendered: "Level 5 Section Title",
                                    },
                                    blocks: &[],
                                    source: Span {
                                        data: "###### Level 5 Section Title",
                                        line: 11,
                                        col: 1,
                                        offset: 138,
                                    },
                                    title_source: None,
                                    title: None,
                                    anchor: None,
                                    anchor_reftext: None,
                                    attrlist: None,
                                    section_type: SectionType::Normal,
                                    section_id: Some("_level_5_section_title"),
                                    caption: None,
                                    section_number: None,
                                },),],
                                source: Span {
                                    data: "##### Level 4 Section Title\n\n###### Level 5 Section Title",
                                    line: 9,
                                    col: 1,
                                    offset: 109,
                                },
                                title_source: None,
                                title: None,
                                anchor: None,
                                anchor_reftext: None,
                                attrlist: None,
                                section_type: SectionType::Normal,
                                section_id: Some("_level_4_section_title"),
                                caption: None,
                                section_number: None,
                            },),],
                            source: Span {
                                data: "#### Level 3 Section Title\n\n##### Level 4 Section Title\n\n###### Level 5 Section Title",
                                line: 7,
                                col: 1,
                                offset: 81,
                            },
                            title_source: None,
                            title: None,
                            anchor: None,
                            anchor_reftext: None,
                            attrlist: None,
                            section_type: SectionType::Normal,
                            section_id: Some("_level_3_section_title"),
                            caption: None,
                            section_number: None,
                        },),],
                        source: Span {
                            data: "### Level 2 Section Title\n\n#### Level 3 Section Title\n\n##### Level 4 Section Title\n\n###### Level 5 Section Title",
                            line: 5,
                            col: 1,
                            offset: 54,
                        },
                        title_source: None,
                        title: None,
                        anchor: None,
                        anchor_reftext: None,
                        attrlist: None,
                        section_type: SectionType::Normal,
                        section_id: Some("_level_2_section_title"),
                        caption: None,
                        section_number: None,
                    },),],
                    source: Span {
                        data: "## Level 1 Section Title\n\n### Level 2 Section Title\n\n#### Level 3 Section Title\n\n##### Level 4 Section Title\n\n###### Level 5 Section Title",
                        line: 3,
                        col: 1,
                        offset: 28,
                    },
                    title_source: None,
                    title: None,
                    anchor: None,
                    anchor_reftext: None,
                    attrlist: None,
                    section_type: SectionType::Normal,
                    section_id: Some("_level_1_section_title"),
                    caption: None,
                    section_number: None,
                },),
                Block::Section(SectionBlock {
                    level: 1,
                    section_title: Content {
                        original: Span {
                            data: "Another Level 1 Section Title",
                            line: 13,
                            col: 4,
                            offset: 171,
                        },
                        rendered: "Another Level 1 Section Title",
                    },
                    blocks: &[],
                    source: Span {
                        data: "## Another Level 1 Section Title",
                        line: 13,
                        col: 1,
                        offset: 168,
                    },
                    title_source: None,
                    title: None,
                    anchor: None,
                    anchor_reftext: None,
                    attrlist: None,
                    section_type: SectionType::Normal,
                    section_id: Some("_another_level_1_section_title"),
                    caption: None,
                    section_number: None,
                },),
            ],
            source: Span {
                data: "= Document Title (Level 0)\n\n## Level 1 Section Title\n\n### Level 2 Section Title\n\n#### Level 3 Section Title\n\n##### Level 4 Section Title\n\n###### Level 5 Section Title\n\n## Another Level 1 Section Title",
                line: 1,
                col: 1,
                offset: 0,
            },
            warnings: &[],
            source_map: SourceMap(&[]),
            catalog: Catalog {
                refs: HashMap::from([
                    (
                        "_level_1_section_title",
                        RefEntry {
                            id: "_level_1_section_title",
                            reftext: Some("Level 1 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_another_level_1_section_title",
                        RefEntry {
                            id: "_another_level_1_section_title",
                            reftext: Some("Another Level 1 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_level_5_section_title",
                        RefEntry {
                            id: "_level_5_section_title",
                            reftext: Some("Level 5 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_level_4_section_title",
                        RefEntry {
                            id: "_level_4_section_title",
                            reftext: Some("Level 4 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_level_3_section_title",
                        RefEntry {
                            id: "_level_3_section_title",
                            reftext: Some("Level 3 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                    (
                        "_level_2_section_title",
                        RefEntry {
                            id: "_level_2_section_title",
                            reftext: Some("Level 2 Section Title",),
                            ref_type: RefType::Section,
                        }
                    ),
                ]),
                reftext_to_id: HashMap::from([
                    ("Level 4 Section Title", "_level_4_section_title"),
                    ("Level 2 Section Title", "_level_2_section_title"),
                    (
                        "Another Level 1 Section Title",
                        "_another_level_1_section_title"
                    ),
                    ("Level 5 Section Title", "_level_5_section_title"),
                    ("Level 1 Section Title", "_level_1_section_title"),
                    ("Level 3 Section Title", "_level_3_section_title"),
                ]),
            },
        }
    );
}

// Treating as non-normative since asciidoc-parser says nothing about how
// content is rendered.
non_normative!(
    r#"
== Titles as HTML headings

When the document is converted to HTML 5 (using the built-in `html5` backend), each section title becomes a heading element where the heading level matches the number of equal signs.
For example, a level 1 section (`==`) maps to an `<h2>` element.
"#
);