fix crash
This commit is contained in:
parent
c200cbe07a
commit
d0caa08819
1 changed files with 3 additions and 2 deletions
|
@ -203,8 +203,9 @@ fn fix_headers_ids(html: &str) -> String {
|
|||
html,
|
||||
RewriteStrSettings {
|
||||
element_content_handlers: vec![element!("a[href^='#']", |el| {
|
||||
el.set_attribute("href", &format!("#{}", el.get_attribute("id").unwrap()))
|
||||
.unwrap();
|
||||
if let Some(id) = el.get_attribute("id") {
|
||||
el.set_attribute("href", &format!("#{id}")).unwrap();
|
||||
};
|
||||
Ok(())
|
||||
})],
|
||||
..RewriteStrSettings::default()
|
||||
|
|
Loading…
Reference in a new issue