diff --git a/examples/config.yml b/examples/config.yml index ace7f8d..f7d45fb 100644 --- a/examples/config.yml +++ b/examples/config.yml @@ -61,6 +61,7 @@ http: <<: *css_classes format: html relative_urls: true + chapter_anchor_prefix: 'chapter-' rss: <<: *paths diff --git a/examples/full.chapters.json b/examples/full.chapters.json index 634cbed..c1fdff8 100644 --- a/examples/full.chapters.json +++ b/examples/full.chapters.json @@ -1,13 +1,13 @@ [ { - "slug": "chapter-1", + "slug": "1", "title": "Chapter 1", "chapters": [ ] }, { - "slug": "chapter-2", + "slug": "2", "title": "Chapter 2", "chapters": [ diff --git a/examples/full.html b/examples/full.html index fdc3e33..1192053 100644 --- a/examples/full.html +++ b/examples/full.html @@ -63,13 +63,13 @@ The Rty -
Chapter 1 paragraph text
-
Chapter 2 paragraph text
diff --git a/examples/full.repub b/examples/full.repub
index 81bf7d2..c4f91d4 100644
--- a/examples/full.repub
+++ b/examples/full.repub
@@ -33,7 +33,7 @@ end
-article.chapter 'chapter-1', 'Chapter 1' do |chapter|
+article.chapter '1', 'Chapter 1' do |chapter|
chapter.paragraph do |paragraph|
paragraph.text 'Chapter 1 paragraph text'
end
@@ -41,7 +41,7 @@ end
-article.chapter 'chapter-2', 'Chapter 2' do |chapter|
+article.chapter '2', 'Chapter 2' do |chapter|
chapter.paragraph do |paragraph|
paragraph.text 'Chapter 2 paragraph text'
end
diff --git a/lib/repubmark/config.rb b/lib/repubmark/config.rb
index b278af3..1f0553e 100644
--- a/lib/repubmark/config.rb
+++ b/lib/repubmark/config.rb
@@ -4,6 +4,7 @@ module Repubmark
class Config
OPTIONAL_KEYS = %i[
base_url
+ chapter_anchor_prefix
css_class_annotation
css_class_blockquote_figure
css_class_blockquote_blockquote
diff --git a/lib/repubmark/elems/chapter.rb b/lib/repubmark/elems/chapter.rb
index 308a5eb..1cb8a34 100644
--- a/lib/repubmark/elems/chapter.rb
+++ b/lib/repubmark/elems/chapter.rb
@@ -118,7 +118,9 @@ module Repubmark
end
def build_title_html
- "