Improve chapter anchor slugs

This commit is contained in:
Alex Kotov 2024-10-18 00:06:59 +04:00
parent aaa6256e09
commit 3ef42983d6
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 2 additions and 2 deletions

View file

@ -61,7 +61,7 @@ http:
<<: *css_classes <<: *css_classes
format: html format: html
relative_urls: true relative_urls: true
chapter_anchor_prefix: 'chapter-' chapter_anchor_prefix: 'chapter'
rss: rss:
<<: *paths <<: *paths

View file

@ -119,7 +119,7 @@ module Repubmark
def build_title_html def build_title_html
anchor_prefix = String(config[:chapter_anchor_prefix]).strip anchor_prefix = String(config[:chapter_anchor_prefix]).strip
anchor = %( id="#{anchor_prefix}#@slug") unless anchor_prefix.empty? anchor = %( id="#{anchor_prefix}-#@slug") unless anchor_prefix.empty?
"<h#@level#{anchor}>#@title</h#@level>\n" if @level != 1 "<h#@level#{anchor}>#@title</h#@level>\n" if @level != 1
end end