Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ log = "0.4"
pdf-inspector = "1.14.2"
quick-xml = "0.41.0"
zip = { version = "8.6.0", default-features = false, features = ["deflate"] }
unicode-properties = "0.1.4"

[profile.release]
lto = "thin"
Expand Down
11 changes: 10 additions & 1 deletion src/render/markdown/anchors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use crate::model::{Block, Document, Inline, LinkTarget, inlines_to_plain_text};
use std::collections::{HashMap, HashSet};
use unicode_properties::{GeneralCategory, UnicodeGeneralCategory};

pub(crate) struct AnchorMap {
resolved: HashMap<String, Resolved>,
Expand Down Expand Up @@ -185,7 +186,10 @@ fn gfm_slug(text: &str) -> String {
.filter_map(|c| match c {
' ' => Some('-'),
'-' => Some(c),
c if c.is_alphanumeric() || is_combining_mark(c) || is_connector_punctuation(c) => {
c if (c.is_alphanumeric() && c.general_category() != GeneralCategory::OtherNumber)

@cubic-dev-ai cubic-dev-ai Bot Oct 18, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The slug predicate now drops Other_Number characters, but the gfm_slug documentation still says that numbers are retained. Update the comment to describe the retained numeric categories so the documented contract matches the GitHub-compatible behavior.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/render/markdown/anchors.rs, line 189:

<comment>The slug predicate now drops `Other_Number` characters, but the `gfm_slug` documentation still says that numbers are retained. Update the comment to describe the retained numeric categories so the documented contract matches the GitHub-compatible behavior.</comment>

<file context>
@@ -185,7 +186,10 @@ fn gfm_slug(text: &str) -> String {
             ' ' => Some('-'),
             '-' => Some(c),
-            c if c.is_alphanumeric() || is_combining_mark(c) || is_connector_punctuation(c) => {
+            c if (c.is_alphanumeric() && c.general_category() != GeneralCategory::OtherNumber)
+                || is_combining_mark(c)
+                || is_connector_punctuation(c) =>
</file context>
Fix with cubic

|| is_combining_mark(c)
|| is_connector_punctuation(c) =>
{
Some(c)
}
_ => None,
Expand All @@ -208,7 +212,9 @@ fn is_combining_mark(c: char) -> bool {
| 0x1AB0..=0x1AFF
| 0x1DC0..=0x1DFF
| 0x20D0..=0x20FF
| 0xFE00..=0xFE0F
| 0xFE20..=0xFE2F
| 0xE0100..=0xE01EF
)
}

Expand Down Expand Up @@ -253,6 +259,9 @@ mod tests {
assert_eq!(gfm_slug("combining n\u{0303} tilde"), "combining-n\u{0303}-tilde");
assert_eq!(gfm_slug("देवनागरी क्षि"), "देवनागरी-क्षि");
assert_eq!(gfm_slug("日本語の見出し"), "日本語の見出し");
assert_eq!(gfm_slug("❤️ Love"), "️-love");
assert_eq!(gfm_slug("2️⃣ Second"), "2️⃣-second");
assert_eq!(gfm_slug("x² formula ½"), "x-formula-");
}

#[test]
Expand Down