From 3ef42983d6a54eadf1aef61e82a314c756bb8551 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Fri, 18 Oct 2024 00:06:59 +0400 Subject: [PATCH] Improve chapter anchor slugs --- examples/config.yml | 2 +- lib/repubmark/elems/chapter.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/config.yml b/examples/config.yml index f7d45fb..c46fb1b 100644 --- a/examples/config.yml +++ b/examples/config.yml @@ -61,7 +61,7 @@ http: <<: *css_classes format: html relative_urls: true - chapter_anchor_prefix: 'chapter-' + chapter_anchor_prefix: 'chapter' rss: <<: *paths diff --git a/lib/repubmark/elems/chapter.rb b/lib/repubmark/elems/chapter.rb index 1cb8a34..e13b72c 100644 --- a/lib/repubmark/elems/chapter.rb +++ b/lib/repubmark/elems/chapter.rb @@ -119,7 +119,7 @@ module Repubmark def build_title_html 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? "#@title\n" if @level != 1 end