Skip to content

Commit

Permalink
Merge pull request #363 from mfontanini/pub-multiline-block-quote
Browse files Browse the repository at this point in the history
Make non public nodes public
  • Loading branch information
gjtorikian authored Feb 2, 2024
2 parents 6a8f244 + a356d40 commit 315a25c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::cell::RefCell;
use std::convert::TryFrom;

#[cfg(feature = "shortcodes")]
use crate::parser::shortcodes::NodeShortCode;
pub use crate::parser::shortcodes::NodeShortCode;

use crate::parser::multiline_block_quote::NodeMultilineBlockQuote;
pub use crate::parser::multiline_block_quote::NodeMultilineBlockQuote;

/// The core AST node enum.
#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
3 changes: 3 additions & 0 deletions src/parser/shortcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ pub struct NodeShortCode(
);

impl NodeShortCode {
/// Checks whether the input is a valid short code.
pub fn is_valid(value: &str) -> bool {
emojis::get_by_shortcode(value).is_some()
}

/// Get the underlying shortcode.
pub fn shortcode(&self) -> &str {
&self.0
}

/// Get the emoji for this short code.
pub fn emoji(&self) -> &'static str {
emojis::get_by_shortcode(&self.0).unwrap().as_str()
}
Expand Down

0 comments on commit 315a25c

Please sign in to comment.