Skip to content

Commit

Permalink
Final touches on docs and use u8 for heading level
Browse files Browse the repository at this point in the history
  • Loading branch information
lucperkins committed Jan 9, 2023
1 parent aaefcff commit bfc19bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/adapters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ pub trait SyntaxHighlighterAdapter {
fn build_code_tag(&self, attributes: &HashMap<String, String>) -> String;
}

/// The struct passed to the `HeadingAdapter` for providing a custom heading implementation.
/// The struct passed to the [`HeadingAdapter`] for custom heading implementations.
#[derive(Clone, Debug)]
pub struct HeadingMeta {
/// The level of the heading; from 1 to 6 for ATX headings, 1 or 2 for setext headings.
pub level: u32,
pub level: u8,

/// The content of the heading as a "flattened" string&mdash;flattened in the sense that any
/// `<strong>` or other tags are removed. In the Markdown heading `## This is **bold**`, the
/// `content` would be the string `"This is bold"`.
/// `<strong>` or other tags are removed. In the Markdown heading `## This is **bold**`, for
/// example, the would be the string `"This is bold"`.
pub content: String,
}

/// Implement this adapter for creating a plugin for custom headings (`h1`, `h2`, etc.). The `enter`
/// defines what's rendered prior the AST content of the heading while the `exit` method defines
/// what's rendered after it. Both methods provide access to a [`HeadingMeta`] struct and leave the
/// AST content of the heading unchanged.
/// method defines what's rendered prior the AST content of the heading while the `exit` method
/// defines what's rendered after it. Both methods provide access to a [`HeadingMeta`] struct and
/// leave the AST content of the heading unchanged.
pub trait HeadingAdapter {
/// Called prior to rendering
fn enter(&self, heading: &HeadingMeta) -> String;
Expand Down
2 changes: 1 addition & 1 deletion src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ pub struct NodeCodeBlock {
#[derive(Default, Debug, Clone, Copy)]
pub struct NodeHeading {
/// The level of the header; from 1 to 6 for ATX headings, 1 or 2 for setext headings.
pub level: u32,
pub level: u8,

/// Whether the heading is setext (if not, ATX).
pub setext: bool,
Expand Down

0 comments on commit bfc19bf

Please sign in to comment.