Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make non public nodes public #363

Merged
merged 4 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading