html: attempt to slugify *-prefixed links
this will cause a broken link if the target heading has a CUSTOM_ID property, but still better than always resulting in a broken link
This commit is contained in:
parent
19acf572fc
commit
6358761bc0
@ -57,9 +57,13 @@ impl Traverser for Handler {
|
||||
Event::Enter(Container::Link(link)) => {
|
||||
let path = link.path();
|
||||
let path = path.trim_start_matches("file:");
|
||||
let path = if let Some(p) = path.strip_prefix('*') {
|
||||
let mut p = slugify!(p);
|
||||
p.insert(0, '#');
|
||||
p
|
||||
// FIXME: breaks if linking to bare .org domain.
|
||||
// hopefully most have a trailing slash?
|
||||
let path = if let Some(p) = path.strip_suffix(".org") {
|
||||
} else if let Some(p) = path.strip_suffix(".org") {
|
||||
let mut p = p.to_string();
|
||||
p.push_str(".html");
|
||||
p
|
||||
|
Loading…
Reference in New Issue
Block a user