aboutsummaryrefslogtreecommitdiff
path: root/_plugins/add-anchor-to-header-from-header-id.rb
diff options
context:
space:
mode:
Diffstat (limited to '_plugins/add-anchor-to-header-from-header-id.rb')
-rw-r--r--_plugins/add-anchor-to-header-from-header-id.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/_plugins/add-anchor-to-header-from-header-id.rb b/_plugins/add-anchor-to-header-from-header-id.rb
index 8846b24..373389a 100644
--- a/_plugins/add-anchor-to-header-from-header-id.rb
+++ b/_plugins/add-anchor-to-header-from-header-id.rb
@@ -1,9 +1,11 @@
Jekyll::Hooks.register [:documents, :pages], :post_render do |doc|
if doc.output_ext == ".html" && doc.type != :slides
+ lang = doc.data["lang"]
+ alt = doc.site.site_payload["site"]["t"]["alt"]["link_icon"][lang]
doc.output =
doc.output.gsub(
/<h([1-6])(.*?)id="([\w-]+)"(.*?)>(.*?)<\/h[1-6]>/,
- '<div class="header-anchor"><h\1\2id="\3"\4>\5</h\1><a href="#\3"><img class="simple-icon" src="/images/link.svg" aria-hidden="true" alt="link icon for showing link to this header" /></a></div>'
+ '<div class="header-anchor"><h\1\2id="\3"\4>\5</h\1><a href="#\3"><img class="simple-icon" src="/images/link.svg" aria-hidden="true" alt="' + alt + '" /></a></div>'
)
end
end