aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-16 16:49:29 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-16 16:49:53 +0200
commit6ee90b34c87354baf8e03d5469a92cf5dd17a82b (patch)
treecfa64be772be6464e6f790dabccf8a77e7afe60e /src/event.rs
parent93d0b7c6465f4ffe220b3ddada729746b11eb6ce (diff)
downloadmarkdown-rs-6ee90b34c87354baf8e03d5469a92cf5dd17a82b.tar.gz
markdown-rs-6ee90b34c87354baf8e03d5469a92cf5dd17a82b.tar.bz2
markdown-rs-6ee90b34c87354baf8e03d5469a92cf5dd17a82b.zip
Add support for frontmatter
Diffstat (limited to 'src/event.rs')
-rw-r--r--src/event.rs92
1 files changed, 91 insertions, 1 deletions
diff --git a/src/event.rs b/src/event.rs
index 8058d64..f2f8ae1 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -1832,10 +1832,98 @@ pub enum Name {
/// ^ ^ ^
/// ```
ThematicBreakSequence,
+
+ /// Whole frontmatter.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [document content][crate::construct::document]
+ /// * **Content model**:
+ /// [`FrontmatterFence`][Name::FrontmatterFence],
+ /// [`FrontmatterChunk`][Name::FrontmatterChunk],
+ /// [`LineEnding`][Name::LineEnding]
+ /// * **Construct**:
+ /// [`frontmatter`][crate::construct::frontmatter]
+ ///
+ /// ## Example
+ ///
+ /// ````markdown
+ /// > | ---
+ /// ^^^
+ /// > | title: Neptune
+ /// ^^^^^^^^^^^^^^
+ /// > | ---
+ /// ^^^
+ /// ````
+ Frontmatter,
+ /// Frontmatter chunk.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Frontmatter`][Name::Frontmatter]
+ /// * **Content model**:
+ /// void
+ /// * **Construct**:
+ /// [`frontmatter`][crate::construct::frontmatter]
+ ///
+ /// ## Example
+ ///
+ /// ````markdown
+ /// | ---
+ /// > | title: Neptune
+ /// ^^^^^^^^^^^^^^
+ /// | ---
+ /// ````
+ FrontmatterChunk,
+ /// Frontmatter fence.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`Frontmatter`][Name::Frontmatter]
+ /// * **Content model**:
+ /// [`FrontmatterSequence`][Name::FrontmatterSequence],
+ /// [`SpaceOrTab`][Name::SpaceOrTab]
+ /// * **Construct**:
+ /// [`frontmatter`][crate::construct::frontmatter]
+ ///
+ /// ## Example
+ ///
+ /// ````markdown
+ /// > | ---
+ /// ^^^
+ /// | title: Neptune
+ /// > | ---
+ /// ^^^
+ /// ````
+ FrontmatterFence,
+ /// Frontmatter sequence.
+ ///
+ /// ## Info
+ ///
+ /// * **Context**:
+ /// [`FrontmatterFence`][Name::FrontmatterFence]
+ /// * **Content model**:
+ /// void
+ /// * **Construct**:
+ /// [`frontmatter`][crate::construct::frontmatter]
+ ///
+ /// ## Example
+ ///
+ /// ````markdown
+ /// > | ---
+ /// ^^^
+ /// | title: Neptune
+ /// > | ---
+ /// ^^^
+ /// ````
+ FrontmatterSequence,
}
/// List of void events, used to make sure everything is working well.
-pub const VOID_EVENTS: [Name; 41] = [
+pub const VOID_EVENTS: [Name; 43] = [
Name::AttentionSequence,
Name::AutolinkEmail,
Name::AutolinkMarker,
@@ -1860,6 +1948,8 @@ pub const VOID_EVENTS: [Name; 41] = [
Name::DefinitionMarker,
Name::DefinitionTitleMarker,
Name::EmphasisSequence,
+ Name::FrontmatterChunk,
+ Name::FrontmatterSequence,
Name::HardBreakEscape,
Name::HardBreakTrailing,
Name::HeadingAtxSequence,