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

About shortcodes, maybe a bug? #340

Closed
jcold opened this issue Sep 12, 2023 · 1 comment · Fixed by #427
Closed

About shortcodes, maybe a bug? #340

jcold opened this issue Sep 12, 2023 · 1 comment · Fixed by #427

Comments

@jcold
Copy link

jcold commented Sep 12, 2023

I found some shortcodes cant not recognize, e.g. :-1: :+1: , but emojis work fine.

// Cargo.toml

[package]
name = "emoji"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
comrak = { version = "0.18.0", features = ["emojis", "shortcodes"] }
emojis = "0.5"

// main.rs

use comrak::{markdown_to_html, ComrakOptions};

fn main() {
    let rocket = emojis::get_by_shortcode("+1").unwrap();
    assert_eq!("👍", rocket.as_str());

    let mut opts = ComrakOptions::default();
    opts.extension.shortcodes = true;

    assert_eq!(
        markdown_to_html(":-1: :+1: :question:", &opts),
        "👎 👍 ❓"
    );

    println!("Hello, world! {}", rocket);
}
@kivikakk
Copy link
Owner

Thanks for this report, and sorry for the delay in getting back to you! Fix is forthcoming in #427.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants