socketry_markdown/mdast/code_fence.rs
1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4/// Opening fence metadata, matching Markly's `Node::Fence` structure.
5///
6/// This describes the source opening fence. The closing fence can be longer
7/// or absent for ordinary code blocks. Markdown serialization may use a
8/// different fence according to its formatting options and content safety.
9#[derive(Clone, Copy, Debug, Eq, PartialEq)]
10#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
11pub struct CodeFence {
12 /// Fence marker: a backtick or tilde for code, or a dash/plus for frontmatter.
13 pub character: char,
14 /// Number of markers in the opening fence.
15 pub length: usize,
16 /// Opening indentation in columns, relative to the containing block.
17 /// Container markers and their required whitespace are excluded.
18 pub indent: usize,
19}