1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-22 07:31:09 +00:00

Add spoiler tags (fixes #78)

This commit is contained in:
Felix Ableitner 2024-10-23 10:57:09 +02:00
parent 8fa4fb1078
commit 444be44008
4 changed files with 14 additions and 1 deletions

11
Cargo.lock generated
View file

@ -1735,6 +1735,7 @@ dependencies = [
"leptos_router",
"log",
"markdown-it",
"markdown-it-block-spoiler",
"once_cell",
"pretty_assertions",
"rand",
@ -2293,6 +2294,16 @@ dependencies = [
"unicode-general-category",
]
[[package]]
name = "markdown-it-block-spoiler"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "008a8e4184fd08b5dca0f2b5b2ef8f126c1e83ca797c44ee41f8d7765951360c"
dependencies = [
"itertools 0.13.0",
"markdown-it",
]
[[package]]
name = "matchit"
version = "0.7.3"

View file

@ -81,6 +81,7 @@ smart-default = "0.7.1"
tower-layer = "0.3.3"
katex = { version = "0.4", default-features = false }
include_dir = "0.7.4"
markdown-it-block-spoiler = "1.0.0"
[dev-dependencies]
pretty_assertions = "1.4.1"

View file

@ -72,7 +72,7 @@ async fn serve_wasm() -> MyResult<impl IntoResponse> {
#[debug_handler]
async fn get_font(Path(font): Path<String>) -> MyResult<impl IntoResponse> {
let mut headers = HeaderMap::new();
let headers = HeaderMap::new();
let font_dir = include_dir!("assets/fonts");
let file = font_dir.get_file(font).ok_or(anyhow!("invalid font"))?;
Ok((headers, file.contents()))

View file

@ -33,6 +33,7 @@ fn markdown_parser() -> MarkdownIt {
markdown_it::plugins::extra::strikethrough::add(&mut parser);
markdown_it::plugins::extra::tables::add(&mut parser);
markdown_it::plugins::extra::typographer::add(&mut parser);
markdown_it_block_spoiler::add(&mut parser);
parser.inline.add_rule::<ArticleLinkScanner>();
parser.inline.add_rule::<MathEquationScanner>();
parser