Skip to content

Commit 6952d4c

Browse files
committed
add: bold command
1 parent cdbb983 commit 6952d4c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/bold.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use brack_pdk_rs::{metadata::Metadata, values::Value, types::Type};
1+
use brack_pdk_rs::{metadata::Metadata, types::Type, values::Value};
22
use extism_pdk::{plugin_fn, FnResult, Json, WithReturnCode};
33

44
pub(crate) fn metadata_bold() -> Metadata {
@@ -13,7 +13,7 @@ pub(crate) fn metadata_bold() -> Metadata {
1313
#[plugin_fn]
1414
pub fn bold(Json(args): Json<Vec<Value>>) -> FnResult<String> {
1515
if args.len() != 1 {
16-
return Err(WithReturnCode::new(anyhow::anyhow!("Usage: [* text]"), 1));
16+
return Err(WithReturnCode::new(anyhow::anyhow!("Usage: [std.* text]"), 1));
1717
}
1818
let text = match &args[0] {
1919
Value::Text(t) => t,
@@ -24,5 +24,13 @@ pub fn bold(Json(args): Json<Vec<Value>>) -> FnResult<String> {
2424
))
2525
}
2626
};
27-
Ok(format!("<b>{}</b>", text))
27+
Ok(format!(
28+
"{{
29+
\"t\": \"Strong\",
30+
\"c\": [
31+
{}
32+
]
33+
}},",
34+
text
35+
))
2836
}

0 commit comments

Comments
 (0)