documentation-editor 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ac95f788efe2a2b7956d479047e0f505bcbc1aa
4
- data.tar.gz: 85e3841a84f2d981b4b17af5e989acab139f23b3
3
+ metadata.gz: e2be27160f41ee85490c83d85b751c935771dcbd
4
+ data.tar.gz: 82e49eb9fd73cc4927498c57217289fe2ba70e47
5
5
  SHA512:
6
- metadata.gz: 2796aa7355f83e18becf4f52e133fea9d35bc398b849d8990b97d7637b3edb45d15d4dcc7b318e9c96a4e6dbe44b392776974b60c9513b4b9624c5b66694ad7b
7
- data.tar.gz: 158e1cc4b9b7763a4103ff28baf39b51d7ca5f3716bd220335a788116bee3378be991a64881a73cf3eac27ae76c85e5ea51d9ff7e1bd89c0a656d3252434b226
6
+ metadata.gz: d610cf14999eaf17070997e6b786b68875be7121f0194352d6b979b9fc0cc74bc4507448dda2a0f2a9188ce42808270705f8b607a744d3f708cd0a5405857255
7
+ data.tar.gz: a5862abaae29bf7d6947afda0d99c8bfed19952fa5f8168cf052683a076776fc7192e5c2b658eba57bc2f51aecc137d4f1abb67ff073622360ca1faf2469e029
data/README.md CHANGED
@@ -116,6 +116,9 @@ DocumentationEditor::Config.paperclip_options = {
116
116
 
117
117
  # to wrap your h1 sections with `<section>` tags
118
118
  DocumentationEditor::Config.wrap_h1_with_sections = true
119
+
120
+ # to lower all title levels by 1 (h1 -> h2, h2 -> h3, ..)
121
+ DocumentationEditor::Config.lower_title_levels = true
119
122
  ```
120
123
 
121
124
  ## Extensions
@@ -4,6 +4,7 @@ module DocumentationEditor
4
4
 
5
5
  def to_html(options = {})
6
6
  options = defaulted(options)
7
+ options[:lower_title_levels] = DocumentationEditor::Config.lower_title_levels
7
8
  html = parse_document(options).to_html
8
9
  # resolve the variables
9
10
  html = resolve_variables(options, html)
@@ -55,7 +56,8 @@ module DocumentationEditor
55
56
 
56
57
  private
57
58
  def parse_document(options)
58
- doc = Kramdown::Document.new(content, options.merge(input: 'BlockKramdown'))
59
+ markdown_content = options[:lower_title_levels] ? content.gsub(/^#/, '##') : content
60
+ doc = Kramdown::Document.new(markdown_content, options.merge(input: 'BlockKramdown'))
59
61
 
60
62
  # apply the /if filtering
61
63
  doc.root.children = apply_filtering(doc.root.children, options, [])
@@ -14,5 +14,8 @@ module DocumentationEditor
14
14
 
15
15
  # configure the before_filter used for the preview & show actions
16
16
  attr_accessor :before_filter
17
+
18
+ # lower title levels (h1 -> h2, h2 -> h3, ...)
19
+ attr_accessor :lower_title_levels
17
20
  end
18
21
  end
@@ -1,3 +1,3 @@
1
1
  module DocumentationEditor
2
- VERSION = "0.11.1"
2
+ VERSION = "0.12.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: documentation-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-08 00:00:00.000000000 Z
11
+ date: 2016-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails