sync: bring Rust crates in line with nuwiki main (v0.4.2)
CI / cargo fmt --check (push) Successful in 31s
CI / cargo clippy (push) Successful in 34s
CI / cargo test (push) Successful in 49s
Release / bump + tag (push) Successful in 52s
Release / build aarch64-unknown-linux-gnu (push) Successful in 1m45s
Release / build x86_64-unknown-linux-gnu (push) Successful in 2m3s
Release / build aarch64-unknown-linux-musl (push) Successful in 2m6s
Release / build x86_64-unknown-linux-musl (push) Successful in 2m8s
Release / gitea release (push) Successful in 30s

This commit is contained in:
gffranco
2026-06-24 09:15:09 +00:00
parent d21237cfdc
commit caaafd3cf3
7 changed files with 56 additions and 10 deletions
Generated
+3 -3
View File
@@ -376,11 +376,11 @@ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
[[package]]
name = "nuwiki-core"
version = "0.4.1"
version = "0.4.2"
[[package]]
name = "nuwiki-ls"
version = "0.4.1"
version = "0.4.2"
dependencies = [
"nuwiki-lsp",
"tokio",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "nuwiki-lsp"
version = "0.4.1"
version = "0.4.2"
dependencies = [
"async-trait",
"dashmap 6.1.0",
+1 -1
View File
@@ -3,7 +3,7 @@ resolver = "2"
members = ["crates/*"]
[workspace.package]
version = "0.4.1"
version = "0.4.2"
edition = "2021"
rust-version = "1.83"
authors = ["Gabriel Fróes Franco <gffranco@gmail.com>"]
@@ -526,10 +526,9 @@ impl<'src> LexState<'src> {
if level == 0 {
return false;
}
// Must be followed by at least one space.
if leading_ws + level >= bytes.len() || bytes[leading_ws + level] != b' ' {
return false;
}
// vimwiki accepts both spaced (`== H ==`) and spaceless (`==H==`)
// headings, so we don't require a space after the opening `=`s. The
// title is still trimmed of one optional space per side below.
// Trailing `=`s of the same level.
let trimmed_end = line.trim_end_matches([' ', '\t']);
+21
View File
@@ -77,6 +77,27 @@ fn centered_heading_gets_centered_class() {
assert!(out.contains("<h1 class=\"centered\" id=\"T\">T</h1>"));
}
#[test]
fn spaceless_heading_renders_as_heading() {
// `==Heading==` (no surrounding spaces) is a heading, like vimwiki — not a
// literal `<p>==Heading==</p>`.
let out = render("==Plain==\n");
assert!(
out.contains(
"<div id=\"Plain\"><h2 id=\"Plain\" class=\"header\">\
<a href=\"#Plain\">Plain</a></h2></div>"
),
"got: {out}"
);
// The spaceless + keyword combo from the report: a header, not a badge.
let out2 = render("==TODO==\n");
assert!(
out2.contains("<h2 id=\"TODO\" class=\"header\">"),
"got: {out2}"
);
assert!(!out2.contains("<p>"), "not a paragraph: {out2}");
}
#[test]
fn heading_keyword_renders_as_plain_text_not_badge() {
// `== TODO ==` is a section title, not an inline keyword: it must render as
+26
View File
@@ -85,6 +85,32 @@ fn centered_heading_is_marked_centered() {
assert!(matches!(lexed[2], HeadingClose));
}
#[test]
fn spaceless_heading_is_a_heading() {
// vimwiki accepts `==Heading==` with no spaces around the text.
let lexed = lex("==Plain==\n");
assert_eq!(
lexed,
vec![
HeadingOpen {
level: 2,
centered: false
},
text("Plain"),
HeadingClose,
Newline,
]
);
}
#[test]
fn marker_only_or_unbalanced_lines_are_not_headings() {
// No title between markers, and trailing `=` not at line end → plain text.
assert!(!matches!(lex("======\n")[0], HeadingOpen { .. }));
assert!(!matches!(lex("==> arrow\n")[0], HeadingOpen { .. }));
assert!(!matches!(lex("==a==b\n")[0], HeadingOpen { .. }));
}
#[test]
fn heading_with_inline_bold() {
let lexed = lex("== Hello *world* ==\n");
+1 -1
View File
@@ -17,5 +17,5 @@ name = "nuwiki-ls"
path = "src/main.rs"
[dependencies]
nuwiki-lsp = { path = "../nuwiki-lsp", version = "0.4.1" }
nuwiki-lsp = { path = "../nuwiki-lsp", version = "0.4.2" }
tokio = { version = "1", features = ["macros", "rt-multi-thread", "io-std"] }
+1 -1
View File
@@ -13,7 +13,7 @@ homepage.workspace = true
workspace = true
[dependencies]
nuwiki-core = { path = "../nuwiki-core", version = "0.4.1" }
nuwiki-core = { path = "../nuwiki-core", version = "0.4.2" }
tower-lsp = "0.20"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "io-std", "sync", "fs"] }
dashmap = "6"