just-the-docs 0.3.1 → 0.3.2

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
  SHA256:
3
- metadata.gz: 87c6985104e4168278d239ca574b91c75b417cb9e6eb43cf043a07d8faeb2d2d
4
- data.tar.gz: 16a11958e2715cdfbf29918ff218b58f26d4507634ebd6fbcb9b26a68d7765b6
3
+ metadata.gz: ac9092ff508cd154919cdc59ec256e3a8cc5e77664ac38f56d2150c6677cb824
4
+ data.tar.gz: 0dedab94fdb0dfc0d684e9bd164bfe61280c0b197572ac0ee20804d5890c8ee9
5
5
  SHA512:
6
- metadata.gz: 3d0cece8a1437daee58c56cf476228cbb6dbe74899dd750125e1a898509eb6ae93db7f1c9272d65dd68eb27680069809f4d8f94e09cc3ea6412ba1caf6a53715
7
- data.tar.gz: 0b6024ecb2f568beb97d3aa219958bf86c1179211610beff3e3e11f578d1597d8d796b185845f8926a255648eef35afd62ab56fa90487b7572611aa863a413c4
6
+ metadata.gz: 496a3e88439549090a080202977a0eac87f94ddbd6acaf6843fbe8db2a00dddda3b241949ff71f7332d4c736671142571d756807ddc078d45591ba1c0e646791
7
+ data.tar.gz: ab731d78317a8dbd1c590cd21a2f93ba942a8e0638221674c3f5123938814ae012112a141a05d88b61de4a3badeedeba2bbf9a7cf1c0e1bc8255e3dd73fdeb96
data/README.md CHANGED
@@ -33,6 +33,10 @@ Or install it yourself as:
33
33
 
34
34
  $ gem install just-the-docs
35
35
 
36
+ Alternatively, you can run it inside Docker while developing your site
37
+
38
+ $ docker-compose up
39
+
36
40
  ## Usage
37
41
 
38
42
  [View the documentation](https://pmarsceill.github.io/just-the-docs/) for usage information.
@@ -0,0 +1,65 @@
1
+ {%- comment -%}
2
+ This file can be used to fix the HTML produced by Jekyll for highlighted
3
+ code with line numbers.
4
+
5
+ It works with `{% highlight some_language linenos %}...{% endhighlight %}`
6
+ and with the Kramdown option to add line numbers to fenced code.
7
+
8
+ The implementation was derived from the workaround provided by
9
+ Dmitry Hrabrov (DeXP) at
10
+ https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
11
+
12
+ EXPLANATION
13
+
14
+ The HTML produced by Rouge highlighting with lie numbers is of the form
15
+ `code table`. Jekyll (<= 4.1.1) always wraps the highlighted HTML
16
+ with `pre`. This wrapping is not only unnecessary, but also transforms
17
+ the conforming HTML produced by Rouge to non-conforming HTML, which
18
+ results in HTML validation error reports.
19
+
20
+ The fix removes the outer `pre` tags whenever they contain the pattern
21
+ `<table class="rouge-table">`.
22
+
23
+ Apart from avoiding HTML validation errors, the fix allows the use of
24
+ the [Jekyll layout for compressing HTML](http://jch.penibelst.de),
25
+ which relies on `pre` tags not being nested, according to
26
+ https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-172069842
27
+
28
+ USAGE
29
+
30
+ (Any names can be used for `some_var` and `some_language`.)
31
+
32
+ {% capture some_var %}
33
+ {% highlight some_language linenos %}
34
+ Some code
35
+ {% endhighlight %}
36
+ {% endcapture %}
37
+ {% include fix_linenos.html code=some_var %}
38
+
39
+ For code fences:
40
+
41
+ {% capture some_var %}
42
+ ```some_language
43
+ Some code
44
+ ```
45
+ {% endcapture %}
46
+ {% assign some_var = some_var | markdownify %}
47
+ {% include fix_linenos.html code=some_var %}
48
+
49
+ CAVEATS
50
+
51
+ The above does not work when `Some code` happens to contain the matched string
52
+ `<table class="rouge-table">`.
53
+
54
+ The use of this file overwrites the variable `fix_linenos_code` with `nil`.
55
+
56
+ {%- endcomment -%}
57
+
58
+ {% assign fix_linenos_code = include.code %}
59
+ {% if fix_linenos_code contains '<table class="rouge-table">' %}
60
+ {% assign fix_linenos_code = fix_linenos_code | replace: '<pre class="highlight">', '<pre>' %}
61
+ {% assign fix_linenos_code = fix_linenos_code | replace: "<pre><code", "<code" %}
62
+ {% assign fix_linenos_code = fix_linenos_code | replace: "</code></pre>", "</code>" %}
63
+ {% endif %}
64
+ {{ fix_linenos_code }}
65
+ {% assign fix_linenos_code = nil %}
@@ -10,9 +10,9 @@
10
10
  {% endif %}
11
11
  {% endunless %}
12
12
 
13
- <link rel="shortcut icon" href="{{ 'favicon.ico' | absolute_url }}" type="image/x-icon">
13
+ <link rel="shortcut icon" href="{{ 'favicon.ico' | relative_url }}" type="image/x-icon">
14
14
 
15
- <link rel="stylesheet" href="{{ '/assets/css/just-the-docs-default.css' | absolute_url }}">
15
+ <link rel="stylesheet" href="{{ '/assets/css/just-the-docs-default.css' | relative_url }}">
16
16
 
17
17
  {% if site.ga_tracking != nil %}
18
18
  <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.ga_tracking }}"></script>
@@ -27,9 +27,9 @@
27
27
  {% endif %}
28
28
 
29
29
  {% if site.search_enabled != false %}
30
- <script type="text/javascript" src="{{ '/assets/js/vendor/lunr.min.js' | absolute_url }}"></script>
30
+ <script type="text/javascript" src="{{ '/assets/js/vendor/lunr.min.js' | relative_url }}"></script>
31
31
  {% endif %}
32
- <script type="text/javascript" src="{{ '/assets/js/just-the-docs.js' | absolute_url }}"></script>
32
+ <script type="text/javascript" src="{{ '/assets/js/just-the-docs.js' | relative_url }}"></script>
33
33
 
34
34
  <meta name="viewport" content="width=device-width, initial-scale=1">
35
35
 
@@ -1,55 +1,100 @@
1
1
  <ul class="nav-list">
2
- {%- assign ordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order != nil" -%}
3
- {%- assign unordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order == nil" -%}
2
+ {%- assign included_pages = include.pages
3
+ | where_exp:"item", "item.nav_exclude != true"
4
+ | where_exp:"item", "item.title != nil" -%}
5
+
6
+ {%- comment -%}
7
+ The values of `title` and `nav_order` can be numbers or strings.
8
+ Jekyll gives build failures when sorting on mixtures of different types,
9
+ so numbers and strings need to be sorted separately.
10
+
11
+ Here, numbers are sorted by their values, and come before all strings.
12
+ An omitted `nav_order` value is equivalent to the page's `title` value
13
+ (except that a numerical `title` value is treated as a string).
14
+
15
+ The case-sensitivity of string sorting is determined by `site.nav_sort`.
16
+ {%- endcomment -%}
17
+
18
+ {%- assign string_ordered_pages = included_pages
19
+ | where_exp:"item", "item.nav_order == nil" -%}
20
+ {%- assign nav_ordered_pages = included_pages
21
+ | where_exp:"item", "item.nav_order != nil" -%}
22
+
23
+ {%- comment -%}
24
+ The nav_ordered_pages have to be added to number_ordered_pages and
25
+ string_ordered_pages, depending on the nav_order value.
26
+ The first character of the jsonify result is `"` only for strings.
27
+ {%- endcomment -%}
28
+ {%- assign nav_ordered_groups = nav_ordered_pages
29
+ | group_by_exp:"item", "item.nav_order | jsonify | slice: 0" -%}
30
+ {%- assign number_ordered_pages = "" | split:"X" -%}
31
+ {%- for group in nav_ordered_groups -%}
32
+ {%- if group.name == '"' -%}
33
+ {%- assign string_ordered_pages = string_ordered_pages | concat: group.items -%}
34
+ {%- else -%}
35
+ {%- assign number_ordered_pages = number_ordered_pages | concat: group.items -%}
36
+ {%- endif -%}
37
+ {%- endfor -%}
38
+
39
+ {%- assign sorted_number_ordered_pages = number_ordered_pages | sort:"nav_order" -%}
40
+
41
+ {%- comment -%}
42
+ The string_ordered_pages have to be sorted by nav_order, and otherwise title
43
+ (where appending the empty string to a numeric title converts it to a string).
44
+ After grouping them by those values, the groups are sorted, then the items
45
+ of each group are concatenated.
46
+ {%- endcomment -%}
47
+ {%- assign string_ordered_groups = string_ordered_pages
48
+ | group_by_exp:"item", "item.nav_order | default: item.title | append:''" -%}
4
49
  {%- if site.nav_sort == 'case_insensitive' -%}
5
- {%- assign sorted_ordered_pages_list = ordered_pages_list | sort_natural:"nav_order" -%}
6
- {%- assign sorted_unordered_pages_list = unordered_pages_list | sort_natural:"title" -%}
50
+ {%- assign sorted_string_ordered_groups = string_ordered_groups | sort_natural:"name" -%}
7
51
  {%- else -%}
8
- {%- assign sorted_ordered_pages_list = ordered_pages_list | sort:"nav_order" -%}
9
- {%- assign sorted_unordered_pages_list = unordered_pages_list | sort:"title" -%}
52
+ {%- assign sorted_string_ordered_groups = string_ordered_groups | sort:"name" -%}
10
53
  {%- endif -%}
11
- {%- assign pages_list = sorted_ordered_pages_list | concat: sorted_unordered_pages_list -%}
54
+ {%- assign sorted_string_ordered_pages = "" | split:"X" -%}
55
+ {%- for group in sorted_string_ordered_groups -%}
56
+ {%- assign sorted_string_ordered_pages = sorted_string_ordered_pages | concat: group.items -%}
57
+ {%- endfor -%}
58
+
59
+ {%- assign pages_list = sorted_number_ordered_pages | concat: sorted_string_ordered_pages -%}
60
+
12
61
  {%- for node in pages_list -%}
13
- {%- unless node.nav_exclude -%}
14
- {%- if node.parent == nil and node.title -%}
15
- <li class="nav-list-item{% if page.url == node.url or page.parent == node.title or page.grand_parent == node.title %} active{% endif %}">
16
- {%- if page.parent == node.title or page.grand_parent == node.title -%}
17
- {%- assign first_level_url = node.url | absolute_url -%}
18
- {%- endif -%}
19
- {%- if node.has_children -%}
20
- <a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
21
- {%- endif -%}
22
- <a href="{{ node.url | absolute_url }}" class="nav-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
23
- {%- if node.has_children -%}
24
- {%- assign children_list = pages_list | where: "parent", node.title -%}
25
- <ul class="nav-list ">
26
- {%- for child in children_list -%}
27
- {%- unless child.nav_exclude -%}
28
- <li class="nav-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
29
- {%- if page.url == child.url or page.parent == child.title -%}
30
- {%- assign second_level_url = child.url | absolute_url -%}
31
- {%- endif -%}
32
- {%- if child.has_children -%}
33
- <a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
34
- {%- endif -%}
35
- <a href="{{ child.url | absolute_url }}" class="nav-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
36
- {%- if child.has_children -%}
37
- {%- assign grand_children_list = pages_list | where: "parent", child.title | where: "grand_parent", node.title -%}
38
- <ul class="nav-list">
39
- {%- for grand_child in grand_children_list -%}
40
- <li class="nav-list-item {% if page.url == grand_child.url %} active{% endif %}">
41
- <a href="{{ grand_child.url | absolute_url }}" class="nav-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
42
- </li>
43
- {%- endfor -%}
44
- </ul>
45
- {%- endif -%}
46
- </li>
47
- {%- endunless -%}
48
- {%- endfor -%}
49
- </ul>
50
- {%- endif -%}
51
- </li>
52
- {%- endif -%}
53
- {%- endunless -%}
62
+ {%- if node.parent == nil -%}
63
+ <li class="nav-list-item{% if page.url == node.url or page.parent == node.title or page.grand_parent == node.title %} active{% endif %}">
64
+ {%- if page.parent == node.title or page.grand_parent == node.title -%}
65
+ {%- assign first_level_url = node.url | absolute_url -%}
66
+ {%- endif -%}
67
+ {%- if node.has_children -%}
68
+ <a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
69
+ {%- endif -%}
70
+ <a href="{{ node.url | absolute_url }}" class="nav-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
71
+ {%- if node.has_children -%}
72
+ {%- assign children_list = pages_list | where: "parent", node.title -%}
73
+ <ul class="nav-list ">
74
+ {%- for child in children_list -%}
75
+ <li class="nav-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
76
+ {%- if page.url == child.url or page.parent == child.title -%}
77
+ {%- assign second_level_url = child.url | absolute_url -%}
78
+ {%- endif -%}
79
+ {%- if child.has_children -%}
80
+ <a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
81
+ {%- endif -%}
82
+ <a href="{{ child.url | absolute_url }}" class="nav-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
83
+ {%- if child.has_children -%}
84
+ {%- assign grand_children_list = pages_list | where: "parent", child.title | where: "grand_parent", node.title -%}
85
+ <ul class="nav-list">
86
+ {%- for grand_child in grand_children_list -%}
87
+ <li class="nav-list-item {% if page.url == grand_child.url %} active{% endif %}">
88
+ <a href="{{ grand_child.url | absolute_url }}" class="nav-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
89
+ </li>
90
+ {%- endfor -%}
91
+ </ul>
92
+ {%- endif -%}
93
+ </li>
94
+ {%- endfor -%}
95
+ </ul>
96
+ {%- endif -%}
97
+ </li>
98
+ {%- endif -%}
54
99
  {%- endfor -%}
55
100
  </ul>
@@ -1,18 +1,44 @@
1
1
  {% capture headingsWorkspace %}
2
2
  {% comment %}
3
- Version 1.0.3
3
+ Copyright (c) 2018 Vladimir "allejo" Jimenez
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
25
+ {% endcomment %}
26
+ {% comment %}
27
+ Version 1.0.7
4
28
  https://github.com/allejo/jekyll-anchor-headings
5
29
 
6
30
  "Be the pull request you wish to see in the world." ~Ben Balter
7
31
 
8
32
  Usage:
9
- {% include anchor_headings.html html=content %}
33
+ {% include anchor_headings.html html=content anchorBody="#" %}
10
34
 
11
35
  Parameters:
12
36
  * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
13
37
 
14
38
  Optional Parameters:
15
39
  * beforeHeading (bool) : false - Set to true if the anchor should be placed _before_ the heading's content
40
+ * anchorAttrs (string) : '' - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`;
41
+ the `%heading%` and `%html_id%` placeholders are available
16
42
  * anchorBody (string) : '' - The content that will be placed inside the anchor; the `%heading%` placeholder is available
17
43
  * anchorClass (string) : '' - The class(es) that will be used for each anchor. Separate multiple classes with a space
18
44
  * anchorTitle (string) : '' - The `title` attribute that will be used for anchors
@@ -42,17 +68,22 @@
42
68
  {% assign nextChar = node | replace: '"', '' | strip | slice: 0, 1 %}
43
69
  {% assign headerLevel = nextChar | times: 1 %}
44
70
 
45
- <!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's try to fix it -->
71
+ <!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's see if we need to fix it -->
46
72
  {% if headerLevel == 0 %}
47
- {% if nextChar != '<' and nextChar != '' %}
73
+ <!-- Split up the node based on closing angle brackets and get the first one. -->
74
+ {% assign firstChunk = node | split: '>' | first %}
75
+
76
+ <!-- If the first chunk does NOT contain a '<', that means we've broken another HTML tag that starts with 'h' -->
77
+ {% unless firstChunk contains '<' %}
48
78
  {% capture node %}<h{{ node }}{% endcapture %}
49
- {% endif %}
79
+ {% endunless %}
50
80
 
51
81
  {% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %}
52
82
  {% continue %}
53
83
  {% endif %}
54
84
 
55
- {% assign _workspace = node | split: '</h' %}
85
+ {% capture _closingTag %}</h{{ headerLevel }}>{% endcapture %}
86
+ {% assign _workspace = node | split: _closingTag %}
56
87
  {% assign _idWorkspace = _workspace[0] | split: 'id="' %}
57
88
  {% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
58
89
  {% assign html_id = _idWorkspace[0] %}
@@ -64,7 +95,7 @@
64
95
  {% capture anchor %}{% endcapture %}
65
96
 
66
97
  {% if html_id and headerLevel >= minHeader and headerLevel <= maxHeader %}
67
- {% capture anchor %}href="#{{ html_id}}" aria-labelledby="{{ html_id}}"{% endcapture %}
98
+ {% capture anchor %}href="#{{ html_id }}"{% endcapture %}
68
99
 
69
100
  {% if include.anchorClass %}
70
101
  {% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %}
@@ -74,6 +105,10 @@
74
105
  {% capture anchor %}{{ anchor }} title="{{ include.anchorTitle | replace: '%heading%', header }}"{% endcapture %}
75
106
  {% endif %}
76
107
 
108
+ {% if include.anchorAttrs %}
109
+ {% capture anchor %}{{ anchor }} {{ include.anchorAttrs | replace: '%heading%', header | replace: '%html_id%', html_id }}{% endcapture %}
110
+ {% endif %}
111
+
77
112
  {% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', header | default: '' }}</a>{% endcapture %}
78
113
 
79
114
  <!-- In order to prevent adding extra space after a heading, we'll let the 'anchor' value contain it -->
@@ -93,8 +128,17 @@
93
128
  {{ header }}{{ anchor }}
94
129
  {% endif %}
95
130
  {{ include.bodySuffix }}
96
- </h{{ _workspace | last }}
131
+ </h{{ headerLevel }}>
97
132
  {% endcapture %}
133
+
134
+ <!--
135
+ If we have content after the `</hX>` tag, then we'll want to append that here so we don't lost any content.
136
+ -->
137
+ {% assign chunkCount = _workspace | size %}
138
+ {% if chunkCount > 1 %}
139
+ {% capture new_heading %}{{ new_heading }}{{ _workspace | last }}{% endcapture %}
140
+ {% endif %}
141
+
98
142
  {% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
99
143
  {% endfor %}
100
144
  {% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
@@ -48,7 +48,22 @@ layout: table_wrappers
48
48
  </a>
49
49
  </div>
50
50
  <nav role="navigation" aria-label="Main" id="site-nav" class="site-nav">
51
- {% include nav.html %}
51
+ {% if site.just_the_docs.collections %}
52
+ {% assign collections_size = site.just_the_docs.collections | size %}
53
+ {% for collection_entry in site.just_the_docs.collections %}
54
+ {% assign collection_key = collection_entry[0] %}
55
+ {% assign collection_value = collection_entry[1] %}
56
+ {% assign collection = site[collection_key] %}
57
+ {% if collection_value.nav_exclude != true %}
58
+ {% if collections_size > 1 %}
59
+ <div class="nav-category">{{ collection_value.name }}</div>
60
+ {% endif %}
61
+ {% include nav.html pages=collection %}
62
+ {% endif %}
63
+ {% endfor %}
64
+ {% else %}
65
+ {% include nav.html pages=site.html_pages %}
66
+ {% endif %}
52
67
  </nav>
53
68
  <footer class="site-footer">
54
69
  This site uses <a href="https://github.com/pmarsceill/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.
@@ -101,7 +116,7 @@ layout: table_wrappers
101
116
  {% endunless %}
102
117
  <div id="main-content" class="main-content" role="main">
103
118
  {% if site.heading_anchors != false %}
104
- {% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#svg-link\"></use></svg>" anchorClass="anchor-heading" %}
119
+ {% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#svg-link\"></use></svg>" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
105
120
  {% else %}
106
121
  {{ content }}
107
122
  {% endif %}
@@ -144,7 +159,7 @@ layout: table_wrappers
144
159
  site.gh_edit_view_mode
145
160
  %}
146
161
  <p class="text-small text-grey-dk-000 mb-0">
147
- <a href="{{ site.gh_edit_repository }}/{{ site.gh_edit_view_mode }}/{{ site.gh_edit_branch }}/{{ page.path }}" id="edit-this-page">{{ site.gh_edit_link_text }}</a>
162
+ <a href="{{ site.gh_edit_repository }}/{{ site.gh_edit_view_mode }}/{{ site.gh_edit_branch }}{% if site.gh_edit_source %}/{{ site.gh_edit_source }}{% endif %}/{{ page.path }}" id="edit-this-page">{{ site.gh_edit_link_text }}</a>
148
163
  </p>
149
164
  {% endif %}
150
165
  </div>
@@ -11,23 +11,96 @@ code {
11
11
  border-radius: $border-radius;
12
12
  }
13
13
 
14
- pre.highlight,
15
- figure.highlight {
14
+ // Content structure for highlighted code blocks using fences or Liquid
15
+ //
16
+ // ```[LANG]...```, no kramdown line_numbers:
17
+ // div.[language-LANG.]highlighter-rouge > div.highlight > pre.highlight > code
18
+ //
19
+ // ```[LANG]...```, kramdown line_numbers = true:
20
+ // div.[language-LANG.]highlighter-rouge > div.highlight > pre.highlight > code
21
+ // > div.table-wrapper > table.rouge-table > tbody > tr
22
+ // > td.rouge-gutter.gl > pre.lineno
23
+ // | td.rouge-code > pre
24
+ //
25
+ // {% highlight LANG %}...{% endhighlight %}:
26
+ // figure.highlight > pre > code.language-LANG
27
+ //
28
+ // {% highlight LANG linenos %}...{% endhighlight %}:
29
+ // figure.highlight > pre > code.language-LANG
30
+ // > div.table-wrapper > table.rouge-table > tbody > tr
31
+ // > td.gutter.gl > pre.lineno
32
+ // | td.code > pre
33
+ //
34
+ // fix_linenos removes the outermost pre when it encloses table.rouge-table
35
+ //
36
+ // See docs/index-test.md for some tests.
37
+ //
38
+ // No kramdown line_numbers: fences and Liquid highlighting look the same.
39
+ // Kramdown line_numbers = true: fences have a wider gutter than with Liquid?
40
+
41
+ // ```[LANG]...```
42
+ div.highlighter-rouge {
16
43
  padding: $sp-3;
17
44
  margin-top: 0;
18
- margin-bottom: 0;
45
+ margin-bottom: $sp-3;
19
46
  background-color: $code-background-color;
20
47
  border-radius: $border-radius;
48
+ box-shadow: none;
21
49
  -webkit-overflow-scrolling: touch;
22
50
 
51
+ div.highlight,
52
+ pre.highlight,
23
53
  code {
24
54
  padding: 0;
55
+ margin: 0;
25
56
  border: 0;
26
57
  }
27
58
  }
28
59
 
29
- .highlighter-rouge {
60
+ // {% highlight LANG %}...{% endhighlight %},
61
+ // {% highlight LANG linenos %}...{% endhighlight %}:
62
+ figure.highlight {
63
+ padding: $sp-3;
64
+ margin-top: 0;
30
65
  margin-bottom: $sp-3;
66
+ background-color: $code-background-color;
67
+ border-radius: $border-radius;
68
+ box-shadow: none;
69
+ -webkit-overflow-scrolling: touch;
70
+
71
+ pre,
72
+ code {
73
+ padding: 0;
74
+ margin: 0;
75
+ border: 0;
76
+ }
77
+ }
78
+
79
+ // ```[LANG]...```, kramdown line_numbers = true,
80
+ // {% highlight LANG linenos %}...{% endhighlight %}:
81
+ .highlight .table-wrapper {
82
+ padding: 0;
83
+ margin: 0;
84
+ border: 0;
85
+ box-shadow: none;
86
+
87
+ td,
88
+ pre {
89
+ @include fs-2;
90
+ min-width: 0;
91
+ padding: 0;
92
+ background-color: $code-background-color;
93
+ border: 0;
94
+ }
95
+
96
+ td.gl {
97
+ padding-right: $sp-3;
98
+ }
99
+
100
+ pre {
101
+ margin: 0;
102
+ line-height: 2;
103
+ }
31
104
  }
32
105
 
33
106
  .highlight .c {
@@ -109,7 +109,7 @@
109
109
 
110
110
  dl {
111
111
  display: grid;
112
- grid-template-columns: max-content 1fr;
112
+ grid-template: auto / 10em 1fr;
113
113
  }
114
114
 
115
115
  dt,
@@ -118,16 +118,18 @@
118
118
  }
119
119
 
120
120
  dt {
121
+ grid-column: 1;
122
+ font-weight: 500;
121
123
  text-align: right;
122
-
123
124
  &::after {
124
125
  content: ":";
125
126
  }
126
127
  }
127
128
 
128
129
  dd {
130
+ grid-column: 2;
131
+ margin-bottom: 0;
129
132
  margin-left: 1em;
130
- font-weight: 500;
131
133
  }
132
134
 
133
135
  .anchor-heading {
@@ -131,6 +131,29 @@
131
131
  }
132
132
  }
133
133
 
134
+ .nav-category {
135
+ padding-top: $sp-2;
136
+ padding-right: $gutter-spacing-sm;
137
+ padding-bottom: $sp-2;
138
+ padding-left: $gutter-spacing-sm;
139
+ font-weight: 600;
140
+ text-align: end;
141
+ text-transform: uppercase;
142
+ border-bottom: $border $border-color;
143
+ @include fs-2;
144
+
145
+ @include mq(md) {
146
+ padding-right: $gutter-spacing;
147
+ padding-left: $gutter-spacing;
148
+ margin-top: $gutter-spacing-sm;
149
+ text-align: start;
150
+
151
+ &:first-child {
152
+ margin-top: 0;
153
+ }
154
+ }
155
+ }
156
+
134
157
  // Aux nav
135
158
 
136
159
  .aux-nav {
@@ -284,13 +284,13 @@
284
284
  background-color: $search-background-color;
285
285
 
286
286
  @include mq(md) {
287
- padding-left: #{$sp-4 * 1.25 + $sp-5};
287
+ padding-left: 2.3rem;
288
288
  }
289
289
  }
290
290
 
291
291
  .search-label {
292
292
  @include mq(md) {
293
- padding-left: #{$sp-4 * 1.25};
293
+ padding-left: 0.6rem;
294
294
  }
295
295
  }
296
296
 
@@ -2,14 +2,32 @@
2
2
  // Typography
3
3
  //
4
4
 
5
- $body-font-family: -apple-system, BlinkMacSystemFont, "helvetica neue",
6
- helvetica, roboto, noto, "segoe ui", arial, sans-serif !default;
5
+ $body-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
6
+ Roboto, "Helvetica Neue", Arial, sans-serif !default;
7
7
  $mono-font-family: "SFMono-Regular", Menlo, Consolas, Monospace !default;
8
8
  $root-font-size: 16px !default; // Base font-size for rems
9
9
  $body-line-height: 1.4 !default;
10
10
  $content-line-height: 1.6 !default;
11
11
  $body-heading-line-height: 1.25 !default;
12
12
 
13
+ //
14
+ // Font size
15
+ // `-sm` suffix is the size at the small (and above) media query
16
+ //
17
+
18
+ $font-size-1: 9px !default;
19
+ $font-size-1-sm: 10px !default;
20
+ $font-size-2: 11px !default; //h4 - uppercased!, h6 not uppercased, text-small
21
+ $font-size-3: 12px !default; //h5
22
+ $font-size-4: 14px !default;
23
+ $font-size-5: 16px !default; //h3
24
+ $font-size-6: 18px !default; //h2
25
+ $font-size-7: 24px !default;
26
+ $font-size-8: 32px !default; //h1
27
+ $font-size-9: 36px !default;
28
+ $font-size-10: 42px !default;
29
+ $font-size-10-sm: 48px !default;
30
+
13
31
  //
14
32
  // Colors
15
33
  //
@@ -1,86 +1,84 @@
1
- // Font size
2
-
3
1
  @mixin fs-1 {
4
- font-size: 9px !important;
2
+ font-size: $font-size-1 !important;
5
3
 
6
4
  @include mq(sm) {
7
- font-size: 10px !important;
5
+ font-size: $font-size-1-sm !important;
8
6
  }
9
7
  }
10
8
 
11
9
  @mixin fs-2 {
12
- font-size: 11px !important;
10
+ font-size: $font-size-2 !important;
13
11
 
14
12
  @include mq(sm) {
15
- font-size: 12px !important;
13
+ font-size: $font-size-3 !important;
16
14
  }
17
15
  }
18
16
 
19
17
  @mixin fs-3 {
20
- font-size: 12px !important;
18
+ font-size: $font-size-3 !important;
21
19
 
22
20
  @include mq(sm) {
23
- font-size: 14px !important;
21
+ font-size: $font-size-4 !important;
24
22
  }
25
23
  }
26
24
 
27
25
  @mixin fs-4 {
28
- font-size: 15px !important;
26
+ font-size: $font-size-4 !important;
29
27
 
30
28
  @include mq(sm) {
31
- font-size: 16px !important;
29
+ font-size: $font-size-5 !important;
32
30
  }
33
31
  }
34
32
 
35
33
  @mixin fs-5 {
36
- font-size: 16px !important;
34
+ font-size: $font-size-5 !important;
37
35
 
38
36
  @include mq(sm) {
39
- font-size: 18px !important;
37
+ font-size: $font-size-6 !important;
40
38
  }
41
39
  }
42
40
 
43
41
  @mixin fs-6 {
44
- font-size: 18px !important;
42
+ font-size: $font-size-6 !important;
45
43
 
46
44
  @include mq(sm) {
47
- font-size: 24px !important;
45
+ font-size: $font-size-7 !important;
48
46
  line-height: $body-heading-line-height;
49
47
  }
50
48
  }
51
49
 
52
50
  @mixin fs-7 {
53
- font-size: 24px !important;
51
+ font-size: $font-size-7 !important;
54
52
  line-height: $body-heading-line-height;
55
53
 
56
54
  @include mq(sm) {
57
- font-size: 32px !important;
55
+ font-size: $font-size-8 !important;
58
56
  }
59
57
  }
60
58
 
61
59
  @mixin fs-8 {
62
- font-size: 32px !important;
60
+ font-size: $font-size-8 !important;
63
61
  line-height: $body-heading-line-height;
64
62
 
65
63
  @include mq(sm) {
66
- font-size: 36px !important;
64
+ font-size: $font-size-9 !important;
67
65
  }
68
66
  }
69
67
 
70
68
  @mixin fs-9 {
71
- font-size: 36px !important;
69
+ font-size: $font-size-9 !important;
72
70
  line-height: $body-heading-line-height;
73
71
 
74
72
  @include mq(sm) {
75
- font-size: 42px !important;
73
+ font-size: $font-size-10 !important;
76
74
  }
77
75
  }
78
76
 
79
77
  @mixin fs-10 {
80
- font-size: 42px !important;
78
+ font-size: $font-size-10 !important;
81
79
  line-height: $body-heading-line-height;
82
80
 
83
81
  @include mq(sm) {
84
- font-size: 48px !important;
82
+ font-size: $font-size-10-sm !important;
85
83
  }
86
84
  }
@@ -27,6 +27,10 @@ h4,
27
27
  letter-spacing: 0.1em;
28
28
  }
29
29
 
30
+ h4 code {
31
+ text-transform: none;
32
+ }
33
+
30
34
  h5,
31
35
  .text-epsilon {
32
36
  @include fs-3;
@@ -2,8 +2,21 @@
2
2
  permalink: /assets/js/search-data.json
3
3
  ---
4
4
  {
5
- {%- assign i = 0 -%}
6
- {% for page in site.html_pages %}
5
+ {%- assign i = 0 -%}
6
+ {%- assign pages_array = '' | split: '' -%}
7
+ {%- assign pages_array = pages_array | push: site.html_pages -%}
8
+ {%- if site.just_the_docs.collections -%}
9
+ {%- for collection_entry in site.just_the_docs.collections -%}
10
+ {%- assign collection_key = collection_entry[0] -%}
11
+ {%- assign collection_value = collection_entry[1] -%}
12
+ {%- assign collection = site[collection_key] -%}
13
+ {%- if collection_value.search_exclude != true -%}
14
+ {%- assign pages_array = pages_array | push: collection -%}
15
+ {%- endif -%}
16
+ {%- endfor -%}
17
+ {%- endif -%}
18
+ {%- for pages in pages_array -%}
19
+ {%- for page in pages -%}
7
20
  {%- if page.title and page.search_exclude != true -%}
8
21
  {%- assign page_content = page.content -%}
9
22
  {%- assign heading_level = site.search.heading_level | default: 2 -%}
@@ -14,7 +27,7 @@ permalink: /assets/js/search-data.json
14
27
  {%- endfor -%}
15
28
  {%- assign parts = page_content | split: '<h1' -%}
16
29
  {%- assign title_found = false -%}
17
- {% for part in parts offset: 1 %}
30
+ {%- for part in parts offset: 1 -%}
18
31
  {%- assign titleAndContent = part | split: '</h1>' -%}
19
32
  {%- assign title = titleAndContent[0] | replace_first: '>', '<h1>' | split: '<h1>' -%}
20
33
  {%- assign title = title[1] | strip_html -%}
@@ -54,5 +67,6 @@ permalink: /assets/js/search-data.json
54
67
  {%- assign i = i | plus: 1 -%}
55
68
  {%- endunless -%}
56
69
  {%- endif -%}
57
- {% endfor %}
70
+ {%- endfor -%}
71
+ {%- endfor %}
58
72
  }
@@ -12,8 +12,21 @@ namespace :search do
12
12
  permalink: /assets/js/search-data.json
13
13
  ---
14
14
  {
15
- {%- assign i = 0 -%}
16
- {% for page in site.html_pages %}
15
+ {%- assign i = 0 -%}
16
+ {%- assign pages_array = '' | split: '' -%}
17
+ {%- assign pages_array = pages_array | push: site.html_pages -%}
18
+ {%- if site.just_the_docs.collections -%}
19
+ {%- for collection_entry in site.just_the_docs.collections -%}
20
+ {%- assign collection_key = collection_entry[0] -%}
21
+ {%- assign collection_value = collection_entry[1] -%}
22
+ {%- assign collection = site[collection_key] -%}
23
+ {%- if collection_value.search_exclude != true -%}
24
+ {%- assign pages_array = pages_array | push: collection -%}
25
+ {%- endif -%}
26
+ {%- endfor -%}
27
+ {%- endif -%}
28
+ {%- for pages in pages_array -%}
29
+ {%- for page in pages -%}
17
30
  {%- if page.title and page.search_exclude != true -%}
18
31
  {%- assign page_content = page.content -%}
19
32
  {%- assign heading_level = site.search.heading_level | default: 2 -%}
@@ -24,7 +37,7 @@ permalink: /assets/js/search-data.json
24
37
  {%- endfor -%}
25
38
  {%- assign parts = page_content | split: \'<h1\' -%}
26
39
  {%- assign title_found = false -%}
27
- {% for part in parts offset: 1 %}
40
+ {%- for part in parts offset: 1 -%}
28
41
  {%- assign titleAndContent = part | split: \'</h1>\' -%}
29
42
  {%- assign title = titleAndContent[0] | replace_first: \'>\', \'<h1>\' | split: \'<h1>\' -%}
30
43
  {%- assign title = title[1] | strip_html -%}
@@ -47,7 +60,7 @@ permalink: /assets/js/search-data.json
47
60
  "doc": {{ page.title | jsonify }},
48
61
  "title": {{ title | jsonify }},
49
62
  "content": {{ content | replace: \'</h\', \' . </h\' | replace: \'<hr\', \' . <hr\' | replace: \'</p\', \' . </p\' | replace: \'<ul\', \' . <ul\' | replace: \'</ul\', \' . </ul\' | replace: \'<ol\', \' . <ol\' | replace: \'</ol\', \' . </ol\' | replace: \'</tr\', \' . </tr\' | replace: \'<li\', \' | <li\' | replace: \'</li\', \' | </li\' | replace: \'</td\', \' | </td\' | replace: \'<td\', \' | <td\' | replace: \'</th\', \' | </th\' | replace: \'<th\', \' | <th\' | strip_html | remove: \'Table of contents\' | normalize_whitespace | replace: \'. . .\', \'.\' | replace: \'. .\', \'.\' | replace: \'| |\', \'|\' | append: \' \' | jsonify }},
50
- "url": "{{ url | absolute_url }}",
63
+ "url": "{{ url | relative_url }}",
51
64
  "relUrl": "{{ url }}"
52
65
  }
53
66
  {%- assign i = i | plus: 1 -%}
@@ -58,13 +71,14 @@ permalink: /assets/js/search-data.json
58
71
  "doc": {{ page.title | jsonify }},
59
72
  "title": {{ page.title | jsonify }},
60
73
  "content": {{ parts[0] | replace: \'</h\', \' . </h\' | replace: \'<hr\', \' . <hr\' | replace: \'</p\', \' . </p\' | replace: \'<ul\', \' . <ul\' | replace: \'</ul\', \' . </ul\' | replace: \'<ol\', \' . <ol\' | replace: \'</ol\', \' . </ol\' | replace: \'</tr\', \' . </tr\' | replace: \'<li\', \' | <li\' | replace: \'</li\', \' | </li\' | replace: \'</td\', \' | </td\' | replace: \'<td\', \' | <td\' | replace: \'</th\', \' | </th\' | replace: \'<th\', \' | <th\' | strip_html | remove: \'Table of contents\' | normalize_whitespace | replace: \'. . .\', \'.\' | replace: \'. .\', \'.\' | replace: \'| |\', \'|\' | append: \' \' | jsonify }},
61
- "url": "{{ page.url | absolute_url }}",
74
+ "url": "{{ page.url | relative_url }}",
62
75
  "relUrl": "{{ page.url }}"
63
76
  }
64
77
  {%- assign i = i | plus: 1 -%}
65
78
  {%- endunless -%}
66
79
  {%- endif -%}
67
- {% endfor %}
80
+ {%- endfor -%}
81
+ {%- endfor %}
68
82
  }'
69
83
  end
70
84
  puts 'Done.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: just-the-docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Marsceill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-15 00:00:00.000000000 Z
11
+ date: 2020-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -85,6 +85,7 @@ files:
85
85
  - Rakefile
86
86
  - _includes/css/custom.scss.liquid
87
87
  - _includes/css/just-the-docs.scss.liquid
88
+ - _includes/fix_linenos.html
88
89
  - _includes/head.html
89
90
  - _includes/head_custom.html
90
91
  - _includes/js/custom.js