Skip to content

Commit 0fdd2d0

Browse files
author
Alexandre Stanislawski
committed
fix(live-doc): uses only h4 and fixes style of h4 (mobile)
1 parent a6bb71e commit 0fdd2d0

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

docs/_plugins/toc_generator.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
module Jekyll
44

55
module TOCGenerator
6+
@@selector = 'h1, h2, h3, h4:not(.no-toc)'
67

78
def toc_generate(html)
89
doc = Nokogiri::HTML(html)
910

1011
html = []
1112
current_level = 1
12-
doc.css('h1, h2, h3, h4').each do |tag|
13+
doc.css(@@selector).each do |tag|
1314
level = tag.name[1].to_i
1415
if level > current_level
1516
current_level.upto(level - 1) do
@@ -35,7 +36,7 @@ def toc_generate_menu(html)
3536
html = []
3637
html << '<select>'
3738
current_level = 1
38-
doc.css('h1, h2, h3, h4').each do |tag|
39+
doc.css(@@selector).each do |tag|
3940
level = tag.name[1].to_i
4041
html << "<option value=\"#{tag['id']}\">#{tag.text}</option>"
4142
current_level = level

docs/css/_documentation.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ code {
144144
}
145145
}
146146
}
147-
> p, > div[id], > h1, > h2, > h3, > h4, > h5, > .h1, > .h2, > .h3, > .h4, > .h5, > pre, > .highlight, > ul, > .row {
147+
> p, > div[id], > h1, > h2, > h3, > h4, > h5, > pre, > .highlight, > ul, > .row {
148148
margin-right: 50%;
149149
max-width: 50%;
150150
}
@@ -469,12 +469,12 @@ code {
469469
}
470470
.documentation-content{
471471
padding: 20px 0;
472-
p, h1, h2, h3, h4, .h4, div[id], ul, .highlight {
472+
p, h1, h2, h3, h4, div[id], ul, .highlight {
473473
margin-right: 0;
474474
width: 100%;
475475
max-width: 100%;
476476
}
477-
p, h1, h2, h3 {
477+
p, h1, h2, h3, h4 {
478478
padding: 9.5px;
479479
}
480480
}

docs/documentation.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The library is open-source, based on [React.js](http://facebook.github.io/react/
5454
### Setup
5555

5656
#### From a CDN
57+
{:.no-toc}
5758

5859
<div class="codebox-combo">
5960

@@ -73,6 +74,7 @@ The fastest way to get started is to use a built version of **instantsearch.js**
7374
This will expose the global `instantsearch` function.
7475

7576
#### From NPM
77+
{:.no-toc}
7678

7779
<div class="codebox-combo">
7880

@@ -998,15 +1000,13 @@ The widget may implement some of the following methods (depending on the need of
9981000

9991001

10001002

1001-
<div class="h4">
1002-
Example with jQuery
1003-
</div>
1003+
#### Example with jQuery
1004+
{:.no-toc}
10041005

10051006
You may want to use an existing jQuery library to power your custom widget: that's definitely doable. Take a look at this jQuery-based custom widgets we've done: [<i class="fa fa-github"></i> algolia/instantsearch-ion.rangeSlider](https://github.com/algolia/instantsearch-ion.rangeSlider).
10061007

1007-
<div class="h4">
1008-
Example with React
1009-
</div>
1008+
#### Example with React
1009+
{:.no-toc}
10101010

10111011
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti perspiciatis suscipit voluptas esse quam fugiat recusandae harum, illum, sint animi excepturi at. Aliquid accusamus ratione atque sit ipsam quia itaque.
10121012

@@ -1018,9 +1018,8 @@ We're using [BEM](http://getbem.com/introduction/), a methodology that helps you
10181018

10191019
If you want to build you own theme, we recommend you to start from our default skeleton: [instantsearch.css](https://github.com/algolia/instantsearch.js/blob/master/css/instantsearch.scss).
10201020

1021-
<div class="h4">
1022-
BEM modifiers
1023-
</div>
1021+
#### BEM modifiers
1022+
{:.no-toc}
10241023

10251024
<div class="codebox-combo">
10261025

@@ -1056,9 +1055,8 @@ We're providing a few SCSS mixins to help you write BEM rules. Those mixins can
10561055
</div>
10571056

10581057
<div class="clearfix"></div>
1059-
<div class="h4">
1060-
Example
1061-
</div>
1058+
#### Example
1059+
{:.no-toc}
10621060

10631061
<div class="codebox-combo">
10641062

0 commit comments

Comments
 (0)