Skip to content

Commit

Permalink
feat(templ): livesamplelink
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Nov 12, 2024
1 parent 48ee427 commit a95f39b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions crates/rari-doc/src/templ/templs/embeds/livesamplelink.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use rari_templ_func::rari_f;
use rari_utils::concat_strs;

use crate::error::DocError;
use crate::templ::api::RariApi;

#[allow(clippy::too_many_arguments)]
#[rari_f]
pub fn live_sample_link(id: String, display: String) -> Result<String, DocError> {
let id = RariApi::anchorize(&id);
Ok(concat_strs!(
r##"<a href="#livesample_fullscreen="##,
&id,
r#"">"#,
&display,
"</a>"
))
}
1 change: 1 addition & 0 deletions crates/rari-doc/src/templ/templs/embeds/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pub mod embedinteractiveexample;
pub mod embedyoutube;
pub mod jsfiddleembed;
pub mod livesample;
pub mod livesamplelink;
3 changes: 3 additions & 0 deletions crates/rari-doc/src/templ/templs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ pub fn invoke(
"embedyoutube" => embeds::embedyoutube::embed_youtube_any,
"jsfiddleembed" => embeds::jsfiddleembed::embded_jsfiddle_any,

// live sample link
"livesamplelink" => embeds::livesamplelink::live_sample_link_any,

// badges
"experimentalbadge" | "experimental_inline" => badges::experimental_any,
"nonstandardbadge" | "non-standard_inline" => badges::non_standard_any,
Expand Down

0 comments on commit a95f39b

Please sign in to comment.