use crate::{blocks::BreakType, tests::prelude::*};
track_file!("ref/asciidoc-lang/docs/modules/blocks/partials/thematic-breaks.adoc");
#[test]
fn thematic_break_syntax() {
verifies!(
r#"
== Thematic breaks
A line with three single quotation marks (i.e., `pass:[''']`), shown in <<ex-rule>>, is a special macro that inserts a thematic break (aka horizontal rule).
Like other block forms, the line must be offset by a preceding paragraph by at least one empty line.
.Thematic break syntax
[#ex-rule]
----
'''
----
The result of <<ex-rule>> is displayed below.
====
'''
====
"#
);
let doc = Parser::default().parse("'''");
assert_eq!(first_break(&doc).type_(), BreakType::Thematic);
}
#[test]
fn markdown_style_thematic_breaks() {
non_normative!(
r#"
=== Markdown-style thematic breaks
Asciidoctor recognizes Markdown thematic breaks.
The motivation for this support is to ease migration of Markdown documents to AsciiDoc documents.
"#
);
verifies!(
r#"
To avoid conflicts with AsciiDoc's block delimiter syntax, only 3 repeating characters (`-` or `+*+`) are recognized.
As with Markdown, spaces between the characters is optional.
.Markdown-style thematic break syntax
----
---
- - -
***
* * *
----
"#
);
for src in ["---", "- - -", "***", "* * *"] {
let doc = Parser::default().parse(src);
assert_eq!(
first_break(&doc).type_(),
BreakType::Thematic,
"{src:?} should be a thematic break"
);
}
let doc = Parser::default().parse("----");
let block = doc.nested_blocks().next().expect("expected a block");
assert_eq!(block.resolved_context().as_ref(), "listing");
}