huhu / rust-search-extension

🦀 The ultimate search extension for Rust
https://rust.extension.sh
Apache License 2.0
1.21k stars 52 forks source link

Fix docs.rs TOC if headings contain inline code #278

Closed benediktwerner closed 5 months ago

benediktwerner commented 5 months ago

Example: https://docs.rs/tokio/latest/tokio/sync/index.html

Headings that contain inline code have more than two child nodes since each inline code and text between them is a separate child, so only taking the node value from the second child does not provide the full heading. Worse, if the heading starts with a code tag, the heading will currently be "null" (since nodeValue only works on text nodes).

header.innerText instead gets the complete rendered text of the whole heading across all children.

vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rust-search-extension ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2024 11:09pm