Trying to add syntax highlighting for code
All checks were successful
Build Tavernworks / Explore-Gitea-Actions (push) Successful in 2m49s
All checks were successful
Build Tavernworks / Explore-Gitea-Actions (push) Successful in 2m49s
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "bard"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
edition = "2024"
|
||||
description = "Dioxus components that will display a Tavern blogging system Blog."
|
||||
repository = "/CyberMages/tavern"
|
||||
|
||||
@ -128,6 +128,16 @@ pub fn PostHeader(tale: Tale, adventurer: Option<Adventurer>) -> Element
|
||||
#[component]
|
||||
pub fn Story(text: String) -> Element
|
||||
{
|
||||
use_effect(||
|
||||
{
|
||||
spawn(async
|
||||
{
|
||||
document::eval("hljs.highlightAll();")
|
||||
.await
|
||||
.expect("Error highlighting code");
|
||||
});
|
||||
});
|
||||
|
||||
rsx!
|
||||
{
|
||||
div
|
||||
|
||||
@ -45,6 +45,10 @@ fn BlogLayout() -> Element
|
||||
}
|
||||
}
|
||||
|
||||
// Setup the system to use Highlight.js for code blocks.
|
||||
document::Stylesheet { href: "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/vs2015.css" }
|
||||
document::Script { src: "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js" }
|
||||
|
||||
Outlet::<Page> {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user