From 10d7696e40f956f890a6ab063475ab0b9e1a40b1 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Fri, 18 Oct 2024 16:09:41 +0400 Subject: [PATCH] Double separators for chapter anchors --- examples/full.chapters.json | 2 +- examples/full.html | 6 +++--- lib/repubmark/elems/chapter.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/full.chapters.json b/examples/full.chapters.json index 44ea17e..5c45ec9 100644 --- a/examples/full.chapters.json +++ b/examples/full.chapters.json @@ -11,7 +11,7 @@ "title": "Chapter 2", "chapters": [ { - "slug": "2-nested", + "slug": "2--nested", "title": "Chapter 2.1", "chapters": [ diff --git a/examples/full.html b/examples/full.html index 321e136..1588730 100644 --- a/examples/full.html +++ b/examples/full.html @@ -63,19 +63,19 @@ The Rty -

Chapter 1

+

Chapter 1

Chapter 1 paragraph text

-

Chapter 2

+

Chapter 2

Chapter 2 paragraph text

-

Chapter 2.1

+

Chapter 2.1

Chapter 2.1 paragraph text diff --git a/lib/repubmark/elems/chapter.rb b/lib/repubmark/elems/chapter.rb index ccd4bab..03f5bb7 100644 --- a/lib/repubmark/elems/chapter.rb +++ b/lib/repubmark/elems/chapter.rb @@ -66,11 +66,11 @@ module Repubmark def anchor if parent.instance_of?(self.class) && @level > 2 - "#{parent.anchor}-#@slug" + "#{parent.anchor}--#@slug" elsif anchor_prefix.empty? @slug else - "#{anchor_prefix}-#@slug" + "#{anchor_prefix}--#@slug" end.freeze end