Skip to content

Commit fad70f8

Browse files
authored
update just-the-docs (#293)
* oy * rm vendor * /docs
1 parent 68c80ce commit fad70f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2269
-1180
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
_site
55
Gemfile.lock
66
node_modules
7+
vendor
78
.DS_Store
89
.jekyll-cache
9-
.ruby-version
10+
.ruby-version

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ruby:2.6
2+
3+
ENV LC_ALL C.UTF-8
4+
ENV LANG en_US.UTF-8
5+
ENV LANGUAGE en_US.UTF-8
6+
7+
WORKDIR /usr/src/app
8+
9+
COPY Gemfile just-the-docs.gemspec ./
10+
RUN gem install bundler && bundle install
11+
12+
EXPOSE 4000
13+

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
source "https://rubygems.org"
22
gemspec
3+
group :jekyll_plugins do
4+
gem "jekyll-redirect-from"
5+
end

_config.yml

+51-34
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
1-
# Welcome to Jekyll!
2-
#
3-
# This config file is meant for settings that affect your whole site, values
4-
# which you are expected to set up once and rarely edit after that. If you find
5-
# yourself editing these this file very often, consider using Jekyll's data files
6-
# feature for the data you need to update frequently.
7-
#
8-
# For technical reasons, this file is *NOT* reloaded automatically when you use
9-
# 'jekyll serve'. If you change this file, please restart the server process.
10-
11-
# Site settings
12-
# These are used to personalize your new site. If you look in the HTML files,
13-
# you will see them accessed via {{ site.title }}, {{ site.github_repo }}, and so on.
14-
# You can create any custom variable you would like, and they will be accessible
15-
# in the templates via {{ site.myvariable }}.
16-
title: docs
1+
title: monome/docs
172
description: monome docs
18-
baseurl: "/docs" # the subpath of your site, e.g. /blog
19-
url: "https://monome.org" # the base hostname & protocol for your site, e.g. http://example.com
3+
baseurl: "/docs"
4+
url: "https://monome.org"
205

216
permalink: pretty
22-
exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile", "resources/"]
7+
exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"
8+
, "docs/tests/"
9+
]
10+
11+
# Regression tests
12+
# By default, the pages in /docs/tests are excluded when the ste is built.
13+
# To include them, comment-out the relevant line above.
14+
# Uncommenting the following line doesn't work - see https://github.com/jekyll/jekyll/issues/4791
15+
# include: ["docs/tests/"]
2316

2417
# Set a path/url to a logo that will be displayed instead of the title
2518
#logo: "/assets/images/just-the-docs.png"
2619

2720
# Enable or disable the site search
21+
# Supports true (default) or false
2822
search_enabled: true
2923
search:
3024
# Split pages into sections that can be searched individually
@@ -58,24 +52,47 @@ aux_links:
5852
"community":
5953
- "//llllllll.co"
6054

61-
# Footer content appears at the bottom of every page's main content
62-
footer_content: "<a href=\"https://monome.org/docs/help\">help</a>"
55+
# Makes Aux links open in a new tab. Default is false
56+
aux_links_new_tab: false
57+
58+
# Sort order for navigation links
59+
# nav_sort: case_insensitive # default, equivalent to nil
60+
nav_sort: case_sensitive # Capital letters sorted before lowercase
61+
62+
# Footer content
63+
# appears at the bottom of every page's main content
64+
65+
# Back to top link
66+
back_to_top: true
67+
back_to_top_text: "back to top"
68+
69+
footer_content: "<a href='/docs/help'>help</a>"
6370

64-
# Color scheme currently only supports "dark" or nil (default)
65-
color_scheme: nil
71+
# Footer last edited timestamp
72+
last_edit_timestamp: false # show or hide edit time - page must have `last_modified_date` defined in the frontmatter
73+
last_edit_time_format: "%b %e %Y at %I:%M %p" # uses ruby's time format: https://ruby-doc.org/stdlib-2.7.0/libdoc/time/rdoc/Time.html
6674

67-
# Google Analytics Tracking (optional)
68-
# e.g, UA-1234567-89
69-
#ga_tracking: UA-2709176-10
75+
76+
77+
# Color scheme currently only supports "dark", "light"/nil (default), or a custom scheme that you define
78+
color_scheme: monome
79+
80+
kramdown:
81+
syntax_highlighter_opts:
82+
block:
83+
line_numbers: false
84+
85+
# DEFAULT ENABLED SHIT BELOW BREAKS SYNTAX HIGHLIGHTING
86+
#compress_html:
87+
#clippings: all
88+
#comments: all
89+
#endings: all
90+
#startings: []
91+
#blanklines: false
92+
#profile: false
93+
# ignore:
94+
# envs: all
7095

7196
plugins:
7297
- jekyll-seo-tag
7398
- jekyll-redirect-from
74-
75-
compress_html:
76-
clippings: all
77-
comments: all
78-
endings: all
79-
startings: []
80-
blanklines: false
81-
profile: false

_includes/css/custom.scss.liquid

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "./custom/custom";
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% if site.logo %}
2+
$logo: "{{ site.logo | absolute_url }}";
3+
{% endif %}
4+
@import "./support/support";
5+
@import "./color_schemes/{{ include.color_scheme }}";
6+
@import "./modules";
7+
{% include css/custom.scss.liquid %}

_includes/fix_linenos.html

+65
Original file line numberDiff line numberDiff line change
@@ -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 %}

_includes/footer_custom.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{%- if site.footer_content -%}
2+
<p class="text-small text-grey-dk-100 mb-0">{{ site.footer_content }}</p>
3+
{%- endif -%}

_includes/head.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
<meta charset="UTF-8">
33
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
44

5-
{% if site.plugins.jekyll-seo == nil %}
5+
{% unless site.plugins contains "jekyll-seo-tag" %}
66
<title>{{ page.title }} - {{ site.title }}</title>
77

88
{% if page.description %}
99
<meta name="Description" content="{{ page.description }}">
1010
{% endif %}
11-
{% endif %}
11+
{% endunless %}
1212

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">
1414

15-
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs.css' | absolute_url }}">
15+
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-default.css' | relative_url }}">
1616

1717
{% if site.ga_tracking != nil %}
1818
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.ga_tracking }}"></script>
@@ -21,15 +21,15 @@
2121
function gtag(){dataLayer.push(arguments);}
2222
gtag('js', new Date());
2323

24-
gtag('config', "{{ site.ga_tracking }}");
24+
gtag('config', '{{ site.ga_tracking }}'{% unless site.ga_tracking_anonymize_ip == nil %}, { 'anonymize_ip': true }{% endunless %});
2525
</script>
2626

2727
{% endif %}
2828

2929
{% 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>
3131
{% 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>
3333

3434
<meta name="viewport" content="width=device-width, initial-scale=1">
3535

_includes/header_custom.html

Whitespace-only changes.

_includes/nav.html

+95-40
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,99 @@
1-
<nav role="navigation" aria-label="Main navigation">
2-
<ul class="navigation-list">
3-
{%- assign pages_list = site.html_pages | sort:"nav_order" -%}
4-
{%- for node in pages_list -%}
5-
{%- unless node.nav_exclude or node.layout == "redirect" -%}
1+
<ul class="nav-list">
2+
{%- assign titled_pages = include.pages
3+
| where_exp:"item", "item.title != nil" -%}
4+
5+
{%- comment -%}
6+
The values of `title` and `nav_order` can be numbers or strings.
7+
Jekyll gives build failures when sorting on mixtures of different types,
8+
so numbers and strings need to be sorted separately.
9+
10+
Here, numbers are sorted by their values, and come before all strings.
11+
An omitted `nav_order` value is equivalent to the page's `title` value
12+
(except that a numerical `title` value is treated as a string).
13+
14+
The case-sensitivity of string sorting is determined by `site.nav_sort`.
15+
{%- endcomment -%}
16+
17+
{%- assign string_ordered_pages = titled_pages
18+
| where_exp:"item", "item.nav_order == nil" -%}
19+
{%- assign nav_ordered_pages = titled_pages
20+
| where_exp:"item", "item.nav_order != nil" -%}
21+
22+
{%- comment -%}
23+
The nav_ordered_pages have to be added to number_ordered_pages and
24+
string_ordered_pages, depending on the nav_order value.
25+
The first character of the jsonify result is `"` only for strings.
26+
{%- endcomment -%}
27+
{%- assign nav_ordered_groups = nav_ordered_pages
28+
| group_by_exp:"item", "item.nav_order | jsonify | slice: 0" -%}
29+
{%- assign number_ordered_pages = "" | split:"X" -%}
30+
{%- for group in nav_ordered_groups -%}
31+
{%- if group.name == '"' -%}
32+
{%- assign string_ordered_pages = string_ordered_pages | concat: group.items -%}
33+
{%- else -%}
34+
{%- assign number_ordered_pages = number_ordered_pages | concat: group.items -%}
35+
{%- endif -%}
36+
{%- endfor -%}
37+
38+
{%- assign sorted_number_ordered_pages = number_ordered_pages | sort:"nav_order" -%}
39+
40+
{%- comment -%}
41+
The string_ordered_pages have to be sorted by nav_order, and otherwise title
42+
(where appending the empty string to a numeric title converts it to a string).
43+
After grouping them by those values, the groups are sorted, then the items
44+
of each group are concatenated.
45+
{%- endcomment -%}
46+
{%- assign string_ordered_groups = string_ordered_pages
47+
| group_by_exp:"item", "item.nav_order | default: item.title | append:''" -%}
48+
{%- if site.nav_sort == 'case_insensitive' -%}
49+
{%- assign sorted_string_ordered_groups = string_ordered_groups | sort_natural:"name" -%}
50+
{%- else -%}
51+
{%- assign sorted_string_ordered_groups = string_ordered_groups | sort:"name" -%}
52+
{%- endif -%}
53+
{%- assign sorted_string_ordered_pages = "" | split:"X" -%}
54+
{%- for group in sorted_string_ordered_groups -%}
55+
{%- assign sorted_string_ordered_pages = sorted_string_ordered_pages | concat: group.items -%}
56+
{%- endfor -%}
57+
58+
{%- assign pages_list = sorted_number_ordered_pages | concat: sorted_string_ordered_pages -%}
59+
60+
{%- for node in pages_list -%}
661
{%- if node.parent == nil -%}
7-
<li
8-
class="navigation-list-item{% if page.url == node.url or page.parent == node.title or page.grand_parent == node.title %} active{% endif %}">
9-
{%- if page.parent == node.title or page.grand_parent == node.title -%}
10-
{%- assign first_level_url = node.url | absolute_url -%}
11-
{%- endif -%}
12-
<a href="{{ node.url | absolute_url }}"
13-
class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
14-
{%- if node.has_children -%}
15-
{%- assign children_list = site.html_pages | where: "parent", node.title | sort:"nav_order" -%}
16-
<ul class="navigation-list-child-list ">
17-
{%- for child in children_list -%}
18-
<li class="navigation-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
19-
{%- if page.url == child.url or page.parent == child.title -%}
20-
{%- assign second_level_url = child.url | absolute_url -%}
21-
{%- endif -%}
22-
<a href="{{ child.url | absolute_url }}"
23-
class="navigation-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
24-
{%- if child.has_children -%}
25-
{%- assign grand_children_list = site.html_pages | where: "parent", child.title | sort:"nav_order" -%}
26-
<ul class="navigation-list-child-list">
27-
{%- for grand_child in grand_children_list -%}
28-
<li class="navigation-list-item {% if page.url == grand_child.url %} active{% endif %}">
29-
<a href="{{ grand_child.url | absolute_url }}"
30-
class="navigation-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
62+
{%- unless node.nav_exclude -%}
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 node.has_children -%}
65+
<a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
66+
{%- endif -%}
67+
<a href="{{ node.url | absolute_url }}" class="nav-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
68+
{%- if node.has_children -%}
69+
{%- assign children_list = pages_list | where: "parent", node.title -%}
70+
<ul class="nav-list ">
71+
{%- for child in children_list -%}
72+
{%- unless child.nav_exclude -%}
73+
<li class="nav-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
74+
{%- if child.has_children -%}
75+
<a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
76+
{%- endif -%}
77+
<a href="{{ child.url | absolute_url }}" class="nav-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
78+
{%- if child.has_children -%}
79+
{%- assign grand_children_list = pages_list | where: "parent", child.title | where: "grand_parent", node.title -%}
80+
<ul class="nav-list">
81+
{%- for grand_child in grand_children_list -%}
82+
{%- unless grand_child.nav_exclude -%}
83+
<li class="nav-list-item {% if page.url == grand_child.url %} active{% endif %}">
84+
<a href="{{ grand_child.url | absolute_url }}" class="nav-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
85+
</li>
86+
{%- endunless -%}
87+
{%- endfor -%}
88+
</ul>
89+
{%- endif -%}
3190
</li>
32-
{%- endfor -%}
91+
{%- endunless -%}
92+
{%- endfor -%}
3393
</ul>
34-
{%- endif -%}
35-
</li>
36-
{%- endfor -%}
37-
</ul>
38-
{%- endif -%}
39-
</li>
94+
{%- endif -%}
95+
</li>
96+
{%- endunless -%}
4097
{%- endif -%}
41-
{%- endunless -%}
42-
{%- endfor -%}
43-
</ul>
44-
</nav>
98+
{%- endfor -%}
99+
</ul>

0 commit comments

Comments
 (0)