Browse Source

Normalize xlink:href attributes like HTML href ones…

…so links inside SVGs, such as those in Rust's railroad diagrams, can
work properly.
Calum Smith 3 months ago
parent
commit
ee0e347ed3
1 changed files with 5 additions and 2 deletions
  1. 5 2
      lib/docs/filters/core/normalize_paths.rb

+ 5 - 2
lib/docs/filters/core/normalize_paths.rb

@@ -7,8 +7,11 @@ module Docs
       result[:store_path] = store_path
 
       css('a').each do |link|
-        next unless (href = link['href']) && relative_url_string?(href)
-        link['href'] = normalize_href(href)
+        href = link['href']
+        link['href'] = normalize_href(href) if href && relative_url_string?(href)
+
+        xlink_href = link['xlink:href']
+        link['xlink:href'] = normalize_href(xlink_href) if xlink_href && relative_url_string?(xlink_href)
       end
 
       doc