1
0
mirror of https://github.com/thangisme/notes.git synced 2024-12-21 21:36:31 -05:00

Merge pull request #388 from pmarsceill/v0.3.2

v0.3.2
This commit is contained in:
Patrick Marsceill 2020-09-14 13:49:37 -04:00 committed by GitHub
commit 76f8f064ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
81 changed files with 1493 additions and 132 deletions

View File

@ -1,6 +1,6 @@
---
layout: default
title: Page not found
title: 404
permalink: /404
nav_exclude: true
search_exclude: true

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM ruby:2.6
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
WORKDIR /usr/src/app
COPY Gemfile just-the-docs.gemspec ./
RUN gem install bundler && bundle install
EXPOSE 4000

View File

@ -33,6 +33,10 @@ Or install it yourself as:
$ gem install just-the-docs
Alternatively, you can run it inside Docker while developing your site
$ docker-compose up
## Usage
[View the documentation](https://pmarsceill.github.io/just-the-docs/) for usage information.

View File

@ -19,7 +19,15 @@ baseurl: "/just-the-docs" # the subpath of your site, e.g. /blog
url: "https://pmarsceill.github.io" # the base hostname & protocol for your site, e.g. http://example.com
permalink: pretty
exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"]
exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"
, "docs/tests/"
]
# Regression tests
# By default, the pages in /docs/tests are excluded when the ste is built.
# To include them, comment-out the relevant line above.
# Uncommenting the following line doesn't work - see https://github.com/jekyll/jekyll/issues/4791
# include: ["docs/tests/"]
# Set a path/url to a logo that will be displayed instead of the title
#logo: "/assets/images/just-the-docs.png"
@ -33,13 +41,13 @@ search:
heading_level: 2
# Maximum amount of previews per search result
# Default: 3
previews: 3
previews: 2
# Maximum amount of words to display before a matched word in the preview
# Default: 5
preview_words_before: 5
preview_words_before: 3
# Maximum amount of words to display after a matched word in the preview
# Default: 10
preview_words_after: 10
preview_words_after: 3
# Set the search token separator
# Default: /[\s\-/]+/
# Example: enable support for hyphenated search words
@ -63,8 +71,8 @@ aux_links:
aux_links_new_tab: false
# Sort order for navigation links
nav_sort: case_insensitive # default, equivalent to nil
# nav_sort: case_sensitive # Capital letters sorted before lowercase
# nav_sort: case_insensitive # default, equivalent to nil
nav_sort: case_sensitive # Capital letters sorted before lowercase
# Footer content
# appears at the bottom of every page's main content
@ -86,6 +94,7 @@ gh_edit_link: true # show or hide edit this page link
gh_edit_link_text: "Edit this page on GitHub"
gh_edit_repository: "https://github.com/pmarsceill/just-the-docs" # the github URL for your repo
gh_edit_branch: "master" # the branch that your docs is served from
# gh_edit_source: docs # the source that your files originate from
gh_edit_view_mode: "tree" # "tree" or "edit" if you want the user to jump into the editor immediately
# Color scheme currently only supports "dark", "light"/nil (default), or a custom scheme that you define
@ -99,6 +108,11 @@ ga_tracking_anonymize_ip: true # Use GDPR compliant Google Analytics settings (t
plugins:
- jekyll-seo-tag
kramdown:
syntax_highlighter_opts:
block:
line_numbers: false
compress_html:
clippings: all
comments: all
@ -106,3 +120,5 @@ compress_html:
startings: []
blanklines: false
profile: false
# ignore:
# envs: all

View File

@ -0,0 +1,65 @@
{%- comment -%}
This file can be used to fix the HTML produced by Jekyll for highlighted
code with line numbers.
It works with `{% highlight some_language linenos %}...{% endhighlight %}`
and with the Kramdown option to add line numbers to fenced code.
The implementation was derived from the workaround provided by
Dmitry Hrabrov (DeXP) at
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
EXPLANATION
The HTML produced by Rouge highlighting with lie numbers is of the form
`code table`. Jekyll (<= 4.1.1) always wraps the highlighted HTML
with `pre`. This wrapping is not only unnecessary, but also transforms
the conforming HTML produced by Rouge to non-conforming HTML, which
results in HTML validation error reports.
The fix removes the outer `pre` tags whenever they contain the pattern
`<table class="rouge-table">`.
Apart from avoiding HTML validation errors, the fix allows the use of
the [Jekyll layout for compressing HTML](http://jch.penibelst.de),
which relies on `pre` tags not being nested, according to
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-172069842
USAGE
(Any names can be used for `some_var` and `some_language`.)
{% capture some_var %}
{% highlight some_language linenos %}
Some code
{% endhighlight %}
{% endcapture %}
{% include fix_linenos.html code=some_var %}
For code fences:
{% capture some_var %}
```some_language
Some code
```
{% endcapture %}
{% assign some_var = some_var | markdownify %}
{% include fix_linenos.html code=some_var %}
CAVEATS
The above does not work when `Some code` happens to contain the matched string
`<table class="rouge-table">`.
The use of this file overwrites the variable `fix_linenos_code` with `nil`.
{%- endcomment -%}
{% assign fix_linenos_code = include.code %}
{% if fix_linenos_code contains '<table class="rouge-table">' %}
{% assign fix_linenos_code = fix_linenos_code | replace: '<pre class="highlight">', '<pre>' %}
{% assign fix_linenos_code = fix_linenos_code | replace: "<pre><code", "<code" %}
{% assign fix_linenos_code = fix_linenos_code | replace: "</code></pre>", "</code>" %}
{% endif %}
{{ fix_linenos_code }}
{% assign fix_linenos_code = nil %}

View File

@ -10,9 +10,9 @@
{% endif %}
{% endunless %}
<link rel="shortcut icon" href="{{ 'favicon.ico' | absolute_url }}" type="image/x-icon">
<link rel="shortcut icon" href="{{ 'favicon.ico' | relative_url }}" type="image/x-icon">
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-default.css' | absolute_url }}">
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-default.css' | relative_url }}">
{% if site.ga_tracking != nil %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.ga_tracking }}"></script>
@ -27,9 +27,9 @@
{% endif %}
{% if site.search_enabled != false %}
<script type="text/javascript" src="{{ '/assets/js/vendor/lunr.min.js' | absolute_url }}"></script>
<script type="text/javascript" src="{{ '/assets/js/vendor/lunr.min.js' | relative_url }}"></script>
{% endif %}
<script type="text/javascript" src="{{ '/assets/js/just-the-docs.js' | absolute_url }}"></script>
<script type="text/javascript" src="{{ '/assets/js/just-the-docs.js' | relative_url }}"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -1,55 +1,100 @@
<ul class="nav-list">
{%- assign ordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order != nil" -%}
{%- assign unordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order == nil" -%}
{%- assign included_pages = include.pages
| where_exp:"item", "item.nav_exclude != true"
| where_exp:"item", "item.title != nil" -%}
{%- comment -%}
The values of `title` and `nav_order` can be numbers or strings.
Jekyll gives build failures when sorting on mixtures of different types,
so numbers and strings need to be sorted separately.
Here, numbers are sorted by their values, and come before all strings.
An omitted `nav_order` value is equivalent to the page's `title` value
(except that a numerical `title` value is treated as a string).
The case-sensitivity of string sorting is determined by `site.nav_sort`.
{%- endcomment -%}
{%- assign string_ordered_pages = included_pages
| where_exp:"item", "item.nav_order == nil" -%}
{%- assign nav_ordered_pages = included_pages
| where_exp:"item", "item.nav_order != nil" -%}
{%- comment -%}
The nav_ordered_pages have to be added to number_ordered_pages and
string_ordered_pages, depending on the nav_order value.
The first character of the jsonify result is `"` only for strings.
{%- endcomment -%}
{%- assign nav_ordered_groups = nav_ordered_pages
| group_by_exp:"item", "item.nav_order | jsonify | slice: 0" -%}
{%- assign number_ordered_pages = "" | split:"X" -%}
{%- for group in nav_ordered_groups -%}
{%- if group.name == '"' -%}
{%- assign string_ordered_pages = string_ordered_pages | concat: group.items -%}
{%- else -%}
{%- assign number_ordered_pages = number_ordered_pages | concat: group.items -%}
{%- endif -%}
{%- endfor -%}
{%- assign sorted_number_ordered_pages = number_ordered_pages | sort:"nav_order" -%}
{%- comment -%}
The string_ordered_pages have to be sorted by nav_order, and otherwise title
(where appending the empty string to a numeric title converts it to a string).
After grouping them by those values, the groups are sorted, then the items
of each group are concatenated.
{%- endcomment -%}
{%- assign string_ordered_groups = string_ordered_pages
| group_by_exp:"item", "item.nav_order | default: item.title | append:''" -%}
{%- if site.nav_sort == 'case_insensitive' -%}
{%- assign sorted_ordered_pages_list = ordered_pages_list | sort_natural:"nav_order" -%}
{%- assign sorted_unordered_pages_list = unordered_pages_list | sort_natural:"title" -%}
{%- assign sorted_string_ordered_groups = string_ordered_groups | sort_natural:"name" -%}
{%- else -%}
{%- assign sorted_ordered_pages_list = ordered_pages_list | sort:"nav_order" -%}
{%- assign sorted_unordered_pages_list = unordered_pages_list | sort:"title" -%}
{%- assign sorted_string_ordered_groups = string_ordered_groups | sort:"name" -%}
{%- endif -%}
{%- assign pages_list = sorted_ordered_pages_list | concat: sorted_unordered_pages_list -%}
{%- assign sorted_string_ordered_pages = "" | split:"X" -%}
{%- for group in sorted_string_ordered_groups -%}
{%- assign sorted_string_ordered_pages = sorted_string_ordered_pages | concat: group.items -%}
{%- endfor -%}
{%- assign pages_list = sorted_number_ordered_pages | concat: sorted_string_ordered_pages -%}
{%- for node in pages_list -%}
{%- unless node.nav_exclude -%}
{%- if node.parent == nil and node.title -%}
<li class="nav-list-item{% if page.url == node.url or page.parent == node.title or page.grand_parent == node.title %} active{% endif %}">
{%- if page.parent == node.title or page.grand_parent == node.title -%}
{%- assign first_level_url = node.url | absolute_url -%}
{%- endif -%}
{%- if node.has_children -%}
<a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
{%- endif -%}
<a href="{{ node.url | absolute_url }}" class="nav-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
{%- if node.has_children -%}
{%- assign children_list = pages_list | where: "parent", node.title -%}
<ul class="nav-list ">
{%- for child in children_list -%}
{%- unless child.nav_exclude -%}
<li class="nav-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
{%- if page.url == child.url or page.parent == child.title -%}
{%- assign second_level_url = child.url | absolute_url -%}
{%- endif -%}
{%- if child.has_children -%}
<a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
{%- endif -%}
<a href="{{ child.url | absolute_url }}" class="nav-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
{%- if child.has_children -%}
{%- assign grand_children_list = pages_list | where: "parent", child.title | where: "grand_parent", node.title -%}
<ul class="nav-list">
{%- for grand_child in grand_children_list -%}
<li class="nav-list-item {% if page.url == grand_child.url %} active{% endif %}">
<a href="{{ grand_child.url | absolute_url }}" class="nav-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
</li>
{%- endfor -%}
</ul>
{%- endif -%}
</li>
{%- endunless -%}
{%- endfor -%}
</ul>
{%- endif -%}
</li>
{%- endif -%}
{%- endunless -%}
{%- if node.parent == nil -%}
<li class="nav-list-item{% if page.url == node.url or page.parent == node.title or page.grand_parent == node.title %} active{% endif %}">
{%- if page.parent == node.title or page.grand_parent == node.title -%}
{%- assign first_level_url = node.url | absolute_url -%}
{%- endif -%}
{%- if node.has_children -%}
<a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
{%- endif -%}
<a href="{{ node.url | absolute_url }}" class="nav-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
{%- if node.has_children -%}
{%- assign children_list = pages_list | where: "parent", node.title -%}
<ul class="nav-list ">
{%- for child in children_list -%}
<li class="nav-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
{%- if page.url == child.url or page.parent == child.title -%}
{%- assign second_level_url = child.url | absolute_url -%}
{%- endif -%}
{%- if child.has_children -%}
<a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
{%- endif -%}
<a href="{{ child.url | absolute_url }}" class="nav-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
{%- if child.has_children -%}
{%- assign grand_children_list = pages_list | where: "parent", child.title | where: "grand_parent", node.title -%}
<ul class="nav-list">
{%- for grand_child in grand_children_list -%}
<li class="nav-list-item {% if page.url == grand_child.url %} active{% endif %}">
<a href="{{ grand_child.url | absolute_url }}" class="nav-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
</li>
{%- endfor -%}
</ul>
{%- endif -%}
</li>
{%- endfor -%}
</ul>
{%- endif -%}
</li>
{%- endif -%}
{%- endfor -%}
</ul>

View File

@ -1,18 +1,44 @@
{% capture headingsWorkspace %}
{% comment %}
Version 1.0.3
Copyright (c) 2018 Vladimir "allejo" Jimenez
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
{% endcomment %}
{% comment %}
Version 1.0.7
https://github.com/allejo/jekyll-anchor-headings
"Be the pull request you wish to see in the world." ~Ben Balter
Usage:
{% include anchor_headings.html html=content %}
{% include anchor_headings.html html=content anchorBody="#" %}
Parameters:
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
Optional Parameters:
* beforeHeading (bool) : false - Set to true if the anchor should be placed _before_ the heading's content
* anchorAttrs (string) : '' - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`;
the `%heading%` and `%html_id%` placeholders are available
* anchorBody (string) : '' - The content that will be placed inside the anchor; the `%heading%` placeholder is available
* anchorClass (string) : '' - The class(es) that will be used for each anchor. Separate multiple classes with a space
* anchorTitle (string) : '' - The `title` attribute that will be used for anchors
@ -42,17 +68,22 @@
{% assign nextChar = node | replace: '"', '' | strip | slice: 0, 1 %}
{% assign headerLevel = nextChar | times: 1 %}
<!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's try to fix it -->
<!-- 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 -->
{% if headerLevel == 0 %}
{% if nextChar != '<' and nextChar != '' %}
<!-- Split up the node based on closing angle brackets and get the first one. -->
{% assign firstChunk = node | split: '>' | first %}
<!-- If the first chunk does NOT contain a '<', that means we've broken another HTML tag that starts with 'h' -->
{% unless firstChunk contains '<' %}
{% capture node %}<h{{ node }}{% endcapture %}
{% endif %}
{% endunless %}
{% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %}
{% continue %}
{% endif %}
{% assign _workspace = node | split: '</h' %}
{% capture _closingTag %}</h{{ headerLevel }}>{% endcapture %}
{% assign _workspace = node | split: _closingTag %}
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
{% assign html_id = _idWorkspace[0] %}
@ -64,7 +95,7 @@
{% capture anchor %}{% endcapture %}
{% if html_id and headerLevel >= minHeader and headerLevel <= maxHeader %}
{% capture anchor %}href="#{{ html_id}}" aria-labelledby="{{ html_id}}"{% endcapture %}
{% capture anchor %}href="#{{ html_id }}"{% endcapture %}
{% if include.anchorClass %}
{% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %}
@ -74,6 +105,10 @@
{% capture anchor %}{{ anchor }} title="{{ include.anchorTitle | replace: '%heading%', header }}"{% endcapture %}
{% endif %}
{% if include.anchorAttrs %}
{% capture anchor %}{{ anchor }} {{ include.anchorAttrs | replace: '%heading%', header | replace: '%html_id%', html_id }}{% endcapture %}
{% endif %}
{% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', header | default: '' }}</a>{% endcapture %}
<!-- In order to prevent adding extra space after a heading, we'll let the 'anchor' value contain it -->
@ -93,8 +128,17 @@
{{ header }}{{ anchor }}
{% endif %}
{{ include.bodySuffix }}
</h{{ _workspace | last }}
</h{{ headerLevel }}>
{% endcapture %}
<!--
If we have content after the `</hX>` tag, then we'll want to append that here so we don't lost any content.
-->
{% assign chunkCount = _workspace | size %}
{% if chunkCount > 1 %}
{% capture new_heading %}{{ new_heading }}{{ _workspace | last }}{% endcapture %}
{% endif %}
{% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
{% endfor %}
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}

View File

@ -48,7 +48,22 @@ layout: table_wrappers
</a>
</div>
<nav role="navigation" aria-label="Main" id="site-nav" class="site-nav">
{% include nav.html %}
{% if site.just_the_docs.collections %}
{% assign collections_size = site.just_the_docs.collections | size %}
{% for collection_entry in site.just_the_docs.collections %}
{% assign collection_key = collection_entry[0] %}
{% assign collection_value = collection_entry[1] %}
{% assign collection = site[collection_key] %}
{% if collection_value.nav_exclude != true %}
{% if collections_size > 1 %}
<div class="nav-category">{{ collection_value.name }}</div>
{% endif %}
{% include nav.html pages=collection %}
{% endif %}
{% endfor %}
{% else %}
{% include nav.html pages=site.html_pages %}
{% endif %}
</nav>
<footer class="site-footer">
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
{% endunless %}
<div id="main-content" class="main-content" role="main">
{% if site.heading_anchors != false %}
{% 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" %}
{% 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%\"" %}
{% else %}
{{ content }}
{% endif %}
@ -144,7 +159,7 @@ layout: table_wrappers
site.gh_edit_view_mode
%}
<p class="text-small text-grey-dk-000 mb-0">
<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>
<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>
</p>
{% endif %}
</div>

View File

@ -11,23 +11,96 @@ code {
border-radius: $border-radius;
}
pre.highlight,
figure.highlight {
// Content structure for highlighted code blocks using fences or Liquid
//
// ```[LANG]...```, no kramdown line_numbers:
// div.[language-LANG.]highlighter-rouge > div.highlight > pre.highlight > code
//
// ```[LANG]...```, kramdown line_numbers = true:
// div.[language-LANG.]highlighter-rouge > div.highlight > pre.highlight > code
// > div.table-wrapper > table.rouge-table > tbody > tr
// > td.rouge-gutter.gl > pre.lineno
// | td.rouge-code > pre
//
// {% highlight LANG %}...{% endhighlight %}:
// figure.highlight > pre > code.language-LANG
//
// {% highlight LANG linenos %}...{% endhighlight %}:
// figure.highlight > pre > code.language-LANG
// > div.table-wrapper > table.rouge-table > tbody > tr
// > td.gutter.gl > pre.lineno
// | td.code > pre
//
// fix_linenos removes the outermost pre when it encloses table.rouge-table
//
// See docs/index-test.md for some tests.
//
// No kramdown line_numbers: fences and Liquid highlighting look the same.
// Kramdown line_numbers = true: fences have a wider gutter than with Liquid?
// ```[LANG]...```
div.highlighter-rouge {
padding: $sp-3;
margin-top: 0;
margin-bottom: 0;
margin-bottom: $sp-3;
background-color: $code-background-color;
border-radius: $border-radius;
box-shadow: none;
-webkit-overflow-scrolling: touch;
div.highlight,
pre.highlight,
code {
padding: 0;
margin: 0;
border: 0;
}
}
.highlighter-rouge {
// {% highlight LANG %}...{% endhighlight %},
// {% highlight LANG linenos %}...{% endhighlight %}:
figure.highlight {
padding: $sp-3;
margin-top: 0;
margin-bottom: $sp-3;
background-color: $code-background-color;
border-radius: $border-radius;
box-shadow: none;
-webkit-overflow-scrolling: touch;
pre,
code {
padding: 0;
margin: 0;
border: 0;
}
}
// ```[LANG]...```, kramdown line_numbers = true,
// {% highlight LANG linenos %}...{% endhighlight %}:
.highlight .table-wrapper {
padding: 0;
margin: 0;
border: 0;
box-shadow: none;
td,
pre {
@include fs-2;
min-width: 0;
padding: 0;
background-color: $code-background-color;
border: 0;
}
td.gl {
padding-right: $sp-3;
}
pre {
margin: 0;
line-height: 2;
}
}
.highlight .c {

View File

@ -109,7 +109,7 @@
dl {
display: grid;
grid-template-columns: max-content 1fr;
grid-template: auto / 10em 1fr;
}
dt,
@ -118,16 +118,18 @@
}
dt {
grid-column: 1;
font-weight: 500;
text-align: right;
&::after {
content: ":";
}
}
dd {
grid-column: 2;
margin-bottom: 0;
margin-left: 1em;
font-weight: 500;
}
.anchor-heading {

View File

@ -131,6 +131,29 @@
}
}
.nav-category {
padding-top: $sp-2;
padding-right: $gutter-spacing-sm;
padding-bottom: $sp-2;
padding-left: $gutter-spacing-sm;
font-weight: 600;
text-align: end;
text-transform: uppercase;
border-bottom: $border $border-color;
@include fs-2;
@include mq(md) {
padding-right: $gutter-spacing;
padding-left: $gutter-spacing;
margin-top: $gutter-spacing-sm;
text-align: start;
&:first-child {
margin-top: 0;
}
}
}
// Aux nav
.aux-nav {

View File

@ -284,13 +284,13 @@
background-color: $search-background-color;
@include mq(md) {
padding-left: #{$sp-4 * 1.25 + $sp-5};
padding-left: 2.3rem;
}
}
.search-label {
@include mq(md) {
padding-left: #{$sp-4 * 1.25};
padding-left: 0.6rem;
}
}

View File

@ -2,14 +2,32 @@
// Typography
//
$body-font-family: -apple-system, BlinkMacSystemFont, "helvetica neue",
helvetica, roboto, noto, "segoe ui", arial, sans-serif !default;
$body-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, "Helvetica Neue", Arial, sans-serif !default;
$mono-font-family: "SFMono-Regular", Menlo, Consolas, Monospace !default;
$root-font-size: 16px !default; // Base font-size for rems
$body-line-height: 1.4 !default;
$content-line-height: 1.6 !default;
$body-heading-line-height: 1.25 !default;
//
// Font size
// `-sm` suffix is the size at the small (and above) media query
//
$font-size-1: 9px !default;
$font-size-1-sm: 10px !default;
$font-size-2: 11px !default; //h4 - uppercased!, h6 not uppercased, text-small
$font-size-3: 12px !default; //h5
$font-size-4: 14px !default;
$font-size-5: 16px !default; //h3
$font-size-6: 18px !default; //h2
$font-size-7: 24px !default;
$font-size-8: 32px !default; //h1
$font-size-9: 36px !default;
$font-size-10: 42px !default;
$font-size-10-sm: 48px !default;
//
// Colors
//

View File

@ -1,86 +1,84 @@
// Font size
@mixin fs-1 {
font-size: 9px !important;
font-size: $font-size-1 !important;
@include mq(sm) {
font-size: 10px !important;
font-size: $font-size-1-sm !important;
}
}
@mixin fs-2 {
font-size: 11px !important;
font-size: $font-size-2 !important;
@include mq(sm) {
font-size: 12px !important;
font-size: $font-size-3 !important;
}
}
@mixin fs-3 {
font-size: 12px !important;
font-size: $font-size-3 !important;
@include mq(sm) {
font-size: 14px !important;
font-size: $font-size-4 !important;
}
}
@mixin fs-4 {
font-size: 15px !important;
font-size: $font-size-4 !important;
@include mq(sm) {
font-size: 16px !important;
font-size: $font-size-5 !important;
}
}
@mixin fs-5 {
font-size: 16px !important;
font-size: $font-size-5 !important;
@include mq(sm) {
font-size: 18px !important;
font-size: $font-size-6 !important;
}
}
@mixin fs-6 {
font-size: 18px !important;
font-size: $font-size-6 !important;
@include mq(sm) {
font-size: 24px !important;
font-size: $font-size-7 !important;
line-height: $body-heading-line-height;
}
}
@mixin fs-7 {
font-size: 24px !important;
font-size: $font-size-7 !important;
line-height: $body-heading-line-height;
@include mq(sm) {
font-size: 32px !important;
font-size: $font-size-8 !important;
}
}
@mixin fs-8 {
font-size: 32px !important;
font-size: $font-size-8 !important;
line-height: $body-heading-line-height;
@include mq(sm) {
font-size: 36px !important;
font-size: $font-size-9 !important;
}
}
@mixin fs-9 {
font-size: 36px !important;
font-size: $font-size-9 !important;
line-height: $body-heading-line-height;
@include mq(sm) {
font-size: 42px !important;
font-size: $font-size-10 !important;
}
}
@mixin fs-10 {
font-size: 42px !important;
font-size: $font-size-10 !important;
line-height: $body-heading-line-height;
@include mq(sm) {
font-size: 48px !important;
font-size: $font-size-10-sm !important;
}
}

View File

@ -27,6 +27,10 @@ h4,
letter-spacing: 0.1em;
}
h4 code {
text-transform: none;
}
h5,
.text-epsilon {
@include fs-3;

View File

@ -2,8 +2,21 @@
permalink: /assets/js/search-data.json
---
{
{%- assign i = 0 -%}
{% for page in site.html_pages %}
{%- assign i = 0 -%}
{%- assign pages_array = '' | split: '' -%}
{%- assign pages_array = pages_array | push: site.html_pages -%}
{%- if site.just_the_docs.collections -%}
{%- for collection_entry in site.just_the_docs.collections -%}
{%- assign collection_key = collection_entry[0] -%}
{%- assign collection_value = collection_entry[1] -%}
{%- assign collection = site[collection_key] -%}
{%- if collection_value.search_exclude != true -%}
{%- assign pages_array = pages_array | push: collection -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- for pages in pages_array -%}
{%- for page in pages -%}
{%- if page.title and page.search_exclude != true -%}
{%- assign page_content = page.content -%}
{%- assign heading_level = site.search.heading_level | default: 2 -%}
@ -14,7 +27,7 @@ permalink: /assets/js/search-data.json
{%- endfor -%}
{%- assign parts = page_content | split: '<h1' -%}
{%- assign title_found = false -%}
{% for part in parts offset: 1 %}
{%- for part in parts offset: 1 -%}
{%- assign titleAndContent = part | split: '</h1>' -%}
{%- assign title = titleAndContent[0] | replace_first: '>', '<h1>' | split: '<h1>' -%}
{%- assign title = title[1] | strip_html -%}
@ -54,5 +67,6 @@ permalink: /assets/js/search-data.json
{%- assign i = i | plus: 1 -%}
{%- endunless -%}
{%- endif -%}
{% endfor %}
{%- endfor -%}
{%- endfor %}
}

14
docker-compose.yml Normal file
View File

@ -0,0 +1,14 @@
version: "3.5"
services:
jekyll:
build:
context: ./
ports:
- 4000:4000
volumes:
- .:/usr/src/app
stdin_open: true
tty: true
command: bundle exec jekyll serve -H 0.0.0.0 -t

View File

@ -22,6 +22,7 @@ Just the Docs has some specific configuration parameters that can be defined in
View this site's [_config.yml](https://github.com/pmarsceill/just-the-docs/tree/master/_config.yml) file as an example.
## Site logo
```yaml
@ -99,6 +100,7 @@ gh_edit_link: true # show or hide edit this page link
gh_edit_link_text: "Edit this page on GitHub."
gh_edit_repository: "https://github.com/pmarsceill/just-the-docs" # the github URL for your repo
gh_edit_branch: "master" # the branch that your docs is served from
# gh_edit_source: docs # the source that your files originate from
gh_edit_view_mode: "tree" # "tree" or "edit" if you want the user to jump into the editor immediately
```
@ -106,6 +108,7 @@ gh_edit_view_mode: "tree" # "tree" or "edit" if you want the user to jump into t
- `last_edit_time_format` uses Ruby's DateTime formatter; see examples and more information [at this link.](https://apidock.com/ruby/DateTime/strftime)
- `gh_edit_repository` is the URL of the project's GitHub repository
- `gh_edit_branch` is the branch that the docs site is served from; defaults to `master`
- `gh_edit_source` is the source directory that your project files are stored in (should be the same as [site.source](https://jekyllrb.com/docs/configuration/options/))
- `gh_edit_view_mode` is `"tree"` by default, which brings the user to the github page; switch to `"edit"` to bring the user directly into editing mode
## Color scheme
@ -140,3 +143,52 @@ See [Customization]({{ site.baseurl }}{% link docs/customization.md %}) for more
ga_tracking: UA-5555555-55
ga_tracking_anonymize_ip: true # Use GDPR compliant Google Analytics settings (true by default)
```
## Document collections
By default, the navigation and search include normal [pages](https://jekyllrb.com/docs/pages/).
Instead, you can also use [Jekyll collections](https://jekyllrb.com/docs/collections/) which group documents semantically together.
For example, put all your documentation files in the `_docs` folder and create the `docs` collection:
```yaml
# Define Jekyll collections
collections:
# Define a collection named "docs", its documents reside in the "_docs" directory
docs:
permalink: "/:collection/:path/"
output: true
just_the_docs:
# Define which collections are used in just-the-docs
collections:
# Reference the "docs" collection
docs:
# Give the collection a name
name: Documentation
# Exclude the collection from the navigation
# Supports true or false (default)
nav_exclude: false
# Exclude the collection from the search
# Supports true or false (default)
search_exclude: false
```
You can reference multiple collections.
This creates categories in the navigation with the configured names.
```yaml
collections:
docs:
permalink: "/:collection/:path/"
output: true
tutorials:
permalink: "/:collection/:path/"
output: true
just_the_docs:
collections:
docs:
name: Documentation
tutorials:
name: Tutorials
```

View File

@ -39,7 +39,7 @@ GitHubPages::Dependencies.gems.each do |gem, version|
end
```
#### [](#header-4)Header 4
#### [](#header-4)Header 4 `with code not transformed`
* This is an unordered list following a header.
* This is an unordered list following a header.
@ -140,6 +140,37 @@ end
<dd>Green</dd>
</dl>
#### Multiple description terms and values
Term
: Brief description of Term
Longer Term
: Longer description of Term,
possibly more than one line
Term
: First description of Term,
possibly more than one line
: Second description of Term,
possibly more than one line
Term1
Term2
: Single description of Term1 and Term2,
possibly more than one line
Term1
Term2
: First description of Term1 and Term2,
possibly more than one line
: Second description of Term1 and Term2,
possibly more than one line
### More code
```
Long, single-line code blocks should not wrap. They should horizontally scroll if they are too long. This line should be long enough to demonstrate this.
```

View File

@ -7,11 +7,14 @@ nav_order: 5
# Navigation Structure
{: .no_toc }
## Table of contents
{: .no_toc .text-delta }
<details open markdown="block">
<summary>
Table of contents
</summary>
{: .text-delta }
1. TOC
{:toc}
</details>
---
@ -25,7 +28,7 @@ By default, all pages will appear as top level pages in the main nav unless a pa
## Ordering pages
To specify a page order, use the `nav_order` parameter in your pages' YAML front matter.
To specify a page order, you can use the `nav_order` parameter in your pages' YAML front matter.
#### Example
{: .no_toc }
@ -38,12 +41,13 @@ nav_order: 4
---
```
The specified `nav_order` parameters on a site should be all integers or all strings.
Pages without a `nav_order` parameter are ordered alphabetically by their `title`,
and appear after the explicitly-ordered pages at each level.
By default, all Capital letters are sorted before all lowercase letters;
adding `nav_sort: case_insensitive` in the configuration file ignores case
when sorting strings (but also sorts numbers lexicographically: `10` comes before `1`).
The parameter values determine the order of the top-level pages, and of child pages with the same parent. You can reuse the same parameter values (e.g., integers starting from 1) for the child pages of different parents.
The parameter values can be numbers (integers, floats) and/or strings. When you omit `nav_order` parameters, they default to the titles of the pages, which are ordered alphabetically. Pages with numerical `nav_order` parameters always come before those with strings or default `nav_order` parameters. If you want to make the page order independent of the page titles, you can set explicit `nav_order` parameters on all pages.
By default, all Capital letters come before all lowercase letters; you can add `nav_sort: case_insensitive` in the configuration file to ignore the case. Enclosing strings in quotation marks is optional.
> *Note for users of previous versions:* `nav_sort: case_insensitive` previously affected the ordering of numerical `nav_order` parameters: e.g., `10` came before `2`. Also, all pages with explicit `nav_order` parameters previously came before all pages with default parameters. Both were potentially confusing, and they have now been eliminated.
---
@ -62,6 +66,8 @@ nav_exclude: true
---
```
Pages with no `title` are automatically excluded from the navigation.
---
## Pages with children

22
docs/tests/index.md Normal file
View File

@ -0,0 +1,22 @@
---
layout: default
title: Tests
has_children: true
nav_order: 100
---
# Tests
The main documentation pages of this theme illustrate the use of many of its features, which to some extent tests their implementation. The pages linked below provide further test cases for particular features, and may be useful for regression testing when developing new features.
The default configuration does not include the test pages. To include them, *commment-out* the following line in `_config.yml`:
```yaml
, "docs/tests/"
```
so that it is:
```yaml
# , "docs/tests/"
```
(Apparently Jekyll's `include` does *not* override `exclude` for the same folder...)

View File

@ -0,0 +1,15 @@
---
layout: default
title: Excluded Child
parent: Not Excluded
nav_exclude: true
---
# Excluded Child
This child page is explicitly excluded, and should not appear in the navigation.
```yaml
title: Excluded Child
parent: Not Excluded
nav_exclude: true
```

View File

@ -0,0 +1,17 @@
---
layout: default
title: Excluded Grandchild
parent: Non-excluded Child
grand_parent: Non-excluded
nav_exclude: true
---
# Excluded Grandchild
This grandchild page is explicitly excluded, and should not appear in the navigation.
```yaml
title: Excluded Grandchild
parent: Non-excluded Child
grand_parent: Non-excluded
nav_exclude: true
```

View File

@ -0,0 +1,15 @@
---
layout: default
title: Excluded
has_children: true
nav_exclude: true
---
# Excluded
This top-level page is explicitly excluded, and should not appear in the navigation. Any child pages are implicitly excluded.
```yaml
title: Excluded
has_children: true
nav_exclude: true
```

View File

@ -0,0 +1,15 @@
---
layout: default
title: Non-excluded Child of Excluded
parent: Excluded
nav_exclude: false
---
# Non-excluded Child of Excluded
This child page is explicitly not excluded, but its parent page is excluded, so it should not appear in the navigation.
```yaml
title: Non-excluded Child of Excluded
parent: Excluded
nav_exclude: false
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: Non-excluded Child
parent: Non-excluded
has_children: true
nav_exclude: false
---
# Non-excluded Child
This child page is explicitly not excluded, and should appear in the navigation.
```yaml
title: Non-excluded Child
parent: Non-excluded
nav_exclude: false
```

View File

@ -0,0 +1,17 @@
---
layout: default
title: Non-excluded Grandchild of Excluded
parent: Non-excluded Child
grand_parent: Excluded
nav_exclude: false
---
# Non-excluded Grandchild of Excluded
This grandchild page is explicitly not excluded, and neither is its parent page; but its grandparent page is excluded, so it should not appear in the navigation.
```yaml
title: Non-excluded Grandchild of Excluded
parent: Non-excluded Child
grand_parent: Excluded
nav_exclude: false
```

View File

@ -0,0 +1,17 @@
---
layout: default
title: Non-excluded Grandchild
parent: Non-excluded Child
grand_parent: Non-excluded
nav_exclude: false
---
# Non-excluded Grandchild
This grandchild page is explicitly not excluded, and neither is its parent page nor its grandparent page, so it should appear in the navigation.
```yaml
title: Non-excluded Grandchild of Excluded
parent: Non-excluded Child
grand_parent: Excluded
nav_exclude: false
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: Non-excluded
has_children: true
nav_exclude: false
---
# Non-excluded
This top-level page is explicitly not excluded, and should appear in the navigation.
```yaml
title: Non-excluded
nav_exclude: false
```

View File

@ -0,0 +1,6 @@
---
layout: default
---
# Untitled
This page does not have a `title`, and it is excluded from the navigation -- unless it is located in a Jekyll collection (which provides default titles). To exclude a title-less page from the navigation, regardless of whether it is located in a collection, set `nav_exclude: true`.

View File

@ -0,0 +1,14 @@
---
layout: default
title: A
has_children: true
---
# A
A top-level page
```yaml
title: A
has_children: true
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: B
has_children: true
---
# B
A top-level page
```yaml
title: B
has_children: true
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: C
parent: A
has_children: true
---
# C
A child of page A, and parent of page D
```yaml
title: C
parent: A
has_children: true
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: C
parent: B
has_children: true
---
# C
A child of page B, and parent of page D
```yaml
title: C
parent: B
has_children: true
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: D
parent: C
grand_parent: A
---
# D
A grandchild of page A
```yaml
title: D
parent: C
grand_parent: A
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: D
parent: C
grand_parent: B
---
# D
A grandchild of page B
```yaml
title: D
parent: C
grand_parent: B
```

View File

@ -0,0 +1,28 @@
---
layout: default
title: Navigation
parent: Tests
---
# Navigation
## Parent page disambiguation
- [Page A](grandparent/a/) has a child [page with title C](grandparent/ca/), and a grandchild [page with title D](grandparent/dca/).
- [Page B](grandparent/b/) has a child [page with title C](grandparent/cb/), and a grandchild [page with title D](grandparent/dcb/).
- The grandchild pages specify their parent and grandparent pages, so there is no ambiguity.
## Page exclusion
- An [untitled page](exclude/untitled/) is excluded from the navigation.
- An excluded [top level page](exclude/excluded/), [child page](exclude/excluded-child/), or [grandchild page](exclude/excluded-grandchild/) does not appear.
- A non-excluded [top level page](exclude/non-excluded/) appears; and a non-excluded [child page](exclude/non-excluded-child/) or [grandchild page](exclude/non-excluded-grandchild/) appears if its parent appears.
- A non-excluded child page or grandchild page does not appear if its parent is excluded.
## Page order
- [Default](order/default/), using `title` instead of `nav_order` fields.
- [Strings](order/strings/), lexicographically ordered, possibly case-insensitively.
- [Integers](order/integers/), numerically ordered.
- [Floats](order/floats/), numerically ordered.
- [Mixture](order/mixture/), with numbers before strings.

View File

@ -0,0 +1,14 @@
---
layout: default
title: "10"
parent: Default
grand_parent: Order
---
# 10
```yaml
title: "10"
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: "2"
parent: Default
grand_parent: Order
---
# 2
```yaml
title: "2"
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: A
parent: Default
grand_parent: Order
---
# A
```yaml
title: A
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: aa
parent: Default
grand_parent: Order
---
# aa
```yaml
title: aa
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: Aa
parent: Default
grand_parent: Order
---
# Aa
```yaml
title: Aa
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,15 @@
---
layout: default
title: Default
parent: Order
nav_order: 1
has_children: true
---
# Default Order
When `nav_order` fields are omitted, the pages are ordered alphabetically by their titles.
By default, all Capital letters come before all lowercase letters; you can add `nav_sort: case_insensitive` in the configuration file to ignore the case).
Digits precede letters, and numeric titles are ordered lexicographically: `10` precedes `2` (in contrast to explicit numeric `nav_order` values).

View File

@ -0,0 +1,16 @@
---
layout: default
title: "-1.1"
nav_order: -1.1
parent: Floats
grand_parent: Order
---
# -1.1
```yaml
title: "-1.1"
nav_order: -1.1
parent: Floats
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "0.0"
nav_order: 0.0
parent: Floats
grand_parent: Order
---
# 0.0
```yaml
title: "0.0"
nav_order: 0.0
parent: Floats
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "10.0"
nav_order: 10.0
parent: Floats
grand_parent: Order
---
# 10.0
```yaml
title: "10.0"
nav_order: 10.0
parent: Floats
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "2.2222"
nav_order: 2.2222
parent: Floats
grand_parent: Order
---
# 2.2222
```yaml
title: "2.2222"
nav_order: 2.2222
parent: Floats
grand_parent: Order
```

View File

@ -0,0 +1,13 @@
---
layout: default
title: Floats
parent: Order
nav_order: 4
has_children: true
---
# Floating-Point Order
When `nav_order` fields are floating-point numbers, the pages are ordered in increasing order of the numerical values.
Floats include `0.0` and negative values.

View File

@ -0,0 +1,8 @@
---
layout: default
title: Order
has_children: true
nav_order: 110
---
# Order

View File

@ -0,0 +1,16 @@
---
layout: default
title: "-1"
nav_order: -1
parent: Integers
grand_parent: Order
---
# -1
```yaml
title: "-1"
nav_order: -1
parent: Integers
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "0"
nav_order: 0
parent: Integers
grand_parent: Order
---
# 0
```yaml
title: "0"
nav_order: 0
parent: Integers
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "10"
nav_order: 10
parent: Integers
grand_parent: Order
---
# 10
```yaml
title: "10"
nav_order: 10
parent: Integers
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "2"
nav_order: 2
parent: Integers
grand_parent: Order
---
# 2
```yaml
title: "2"
nav_order: 2
parent: Integers
grand_parent: Order
```

View File

@ -0,0 +1,13 @@
---
layout: default
title: Integers
parent: Order
nav_order: 3
has_children: true
---
# Integer Order
When `nav_order` fields are integers, the pages are ordered in increasing order of the numerical values.
Integers include `0` and negative values. Integers can be reused for top-level pages and for different sets of child pages.

View File

@ -0,0 +1,16 @@
---
layout: default
title: "-1.1"
nav_order: -1.1
parent: Mixture
grand_parent: Order
---
# -1.1
```yaml
title: "-1.1"
nav_order: -1.1
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "-1"
nav_order: -1
parent: Mixture
grand_parent: Order
---
# -1
```yaml
title: "-1"
nav_order: -1
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "0.0"
nav_order: 0.0
parent: Mixture
grand_parent: Order
---
# 0.0
```yaml
title: "0.0"
nav_order: 0.0
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "0"
nav_order: 0
parent: Mixture
grand_parent: Order
---
# 0
```yaml
title: "0"
nav_order: 0
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "10.0"
nav_order: 10.0
parent: Mixture
grand_parent: Order
---
# 10.0
```yaml
title: "10.0"
nav_order: 10.0
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: "10"
parent: Mixture
grand_parent: Order
---
# 10
```yaml
title: "10"
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "2.2222"
nav_order: 2.2222
parent: Mixture
grand_parent: Order
---
# 2.2222
```yaml
title: "2.2222"
nav_order: 2.2222
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: "2"
parent: Mixture
grand_parent: Order
---
# 2
```yaml
title: "2"
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: A
parent: Mixture
grand_parent: Order
---
# A
```yaml
title: A
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: aa
nav_order: "aa"
parent: Mixture
grand_parent: Order
---
# aa
```yaml
title: aa
nav_order: "aa"
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: Aa
nav_order: "Aa"
parent: Mixture
grand_parent: Order
---
# Aa
```yaml
title: Aa
nav_order: "Aa"
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,11 @@
---
layout: default
title: Mixture
parent: Order
nav_order: 5
has_children: true
---
# Mixed Order
It seems unlikely that different types of `nav_order` values are needed for the children of the same parent.

View File

@ -0,0 +1,16 @@
---
layout: default
title: "10"
nav_order: "10"
parent: Strings
grand_parent: Order
---
# 10
```yaml
title: "10"
nav_order: "10"
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "2"
nav_order: "2"
parent: Strings
grand_parent: Order
---
# 2
```yaml
title: "2"
nav_order: "2"
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: A
nav_order: A
parent: Strings
grand_parent: Order
---
# A
```yaml
title: A
nav_order: A
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: aa
nav_order: "aa"
parent: Strings
grand_parent: Order
---
# aa
```yaml
title: aa
nav_order: "aa"
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: Aa
nav_order: "Aa"
parent: Strings
grand_parent: Order
---
# Aa
```yaml
title: Aa
nav_order: "Aa"
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,13 @@
---
layout: default
title: Strings
parent: Order
nav_order: 2
has_children: true
---
# String Order
By default, all Capital letters come before all lowercase letters; you can add `nav_sort: case_insensitive` in the configuration file to ignore the case).
Digits precede letters, and numeric titles are ordered lexicographically: `"10"` precedes `"2"` (in contrast to explicit numeric `nav_order` values).

View File

@ -2,6 +2,7 @@
layout: default
title: Code
parent: UI Components
has_children: true
nav_order: 6
---

View File

@ -0,0 +1,115 @@
---
layout: default
title: Code with line numbers
parent: Code
grand_parent: UI Components
permalink: /docs/ui-components/code/line-numbers/
---
# Code snippets with line numbers
The default settings for HTML compression are incompatible with the HTML
produced by Jekyll (4.1.1 or earlier) for line numbers from highlighted code
-- both when using Kramdown code fences and when using Liquid highlight tags.
To avoid non-conforming HTML and unsatisfactory layout, HTML compression
can be turned off by using the following configuration option:
{% highlight yaml %}
compress_html:
ignore:
envs: all
{% endhighlight %}
When using Kramdown code fences, line numbers are turned on globally by the
following configuration option:
{% highlight yaml %}
kramdown:
syntax_highlighter_opts:
block:
line_numbers: true
{% endhighlight %}
Line numbers can then be suppressed locally using Liquid tags (_without_ the
`linenos` option) instead of fences:
{% highlight yaml %}
{% raw %}{% highlight some_language %}
Some code
{% endhighlight %}{% endraw %}
{% endhighlight %}
## Workarounds
To use HTML compression together with line numbers, all highlighted code
needs to be wrapped using one of the following workarounds.
(The variable name `some_var` can be changed to avoid clashes; it can also
be replaced by `code` -- but note that `code=code` cannot be removed).
### Code fences (three backticks)
{% highlight default %}
{% raw %}{% capture some_var %}
```some_language
Some code
```
{% endcapture %}
{% assign some_var = some_var | markdownify %}
{% include fix_linenos.html code=some_var %}{% endraw %}
{% endhighlight %}
### Liquid highlighting
{% highlight default %}
{% raw %}{% capture some_var %}
{% highlight some_language linenos %}
Some code
{% endhighlight %}
{% endcapture %}
{% include fix_linenos.html code=some_var %}{% endraw %}
{% endhighlight %}
_Credit:_ The original version of the above workaround was suggested by
Dmitry Hrabrov at
<https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901>.
## Examples
✅ Using code fences + workaround (will only show line numbers if enabled globally in `_config.yml`):
{% capture code_fence %}
```js
// Javascript code with syntax highlighting in fences
var fun = function lang(l) {
dateformat.i18n = require('./lang/' + l)
return true;
}
```
{% endcapture %}
{% assign code_fence = code_fence | markdownify %}
{% include fix_linenos.html code=code_fence %}
✅ Using liquid highlighting + workaround:
{% capture code %}
{% highlight ruby linenos %}
# Ruby code with syntax highlighting and fixed line numbers using Liquid
GitHubPages::Dependencies.gems.each do |gem, version|
s.add_dependency(gem, "= #{version}")
end
{% endhighlight %}
{% endcapture %}
{% include fix_linenos.html code=code %}
{% assign code = nil %}
❌ With the default configuration options, the following example illustrates
the **incorrect** formatting arising from the incompatibility of HTML compression
and the non-conforming HTML produced by Jekyll for line numbers:
{% highlight ruby linenos %}
# Ruby code with syntax highlighting and unfixed line numbers using Liquid
GitHubPages::Dependencies.gems.each do |gem, version|
s.add_dependency(gem, "= #{version}")
end
{% endhighlight %}

View File

@ -21,7 +21,7 @@ nav_order: 1
By default, Just the Docs uses a native system font stack for sans-serif fonts:
```scss
-apple-system, BlinkMacSystemFont, "helvetica neue", helvetica, roboto, noto, "segoe ui", arial, sans-serif
system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif
```
ABCDEFGHIJKLMNOPQRSTUVWXYZ

View File

@ -4,7 +4,6 @@ title: Home
nav_order: 1
description: "Just the Docs is a responsive Jekyll theme with built-in search that is easily customizable and hosted on GitHub Pages."
permalink: /
last_modified_date: 2020-04-27T17:54:08+0000
---
# Focus on writing good documentation

View File

@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "just-the-docs"
spec.version = "0.3.1"
spec.version = "0.3.2"
spec.authors = ["Patrick Marsceill"]
spec.email = ["patrick.marsceill@gmail.com"]

View File

@ -12,8 +12,21 @@ namespace :search do
permalink: /assets/js/search-data.json
---
{
{%- assign i = 0 -%}
{% for page in site.html_pages %}
{%- assign i = 0 -%}
{%- assign pages_array = '' | split: '' -%}
{%- assign pages_array = pages_array | push: site.html_pages -%}
{%- if site.just_the_docs.collections -%}
{%- for collection_entry in site.just_the_docs.collections -%}
{%- assign collection_key = collection_entry[0] -%}
{%- assign collection_value = collection_entry[1] -%}
{%- assign collection = site[collection_key] -%}
{%- if collection_value.search_exclude != true -%}
{%- assign pages_array = pages_array | push: collection -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- for pages in pages_array -%}
{%- for page in pages -%}
{%- if page.title and page.search_exclude != true -%}
{%- assign page_content = page.content -%}
{%- assign heading_level = site.search.heading_level | default: 2 -%}
@ -24,7 +37,7 @@ permalink: /assets/js/search-data.json
{%- endfor -%}
{%- assign parts = page_content | split: \'<h1\' -%}
{%- assign title_found = false -%}
{% for part in parts offset: 1 %}
{%- for part in parts offset: 1 -%}
{%- assign titleAndContent = part | split: \'</h1>\' -%}
{%- assign title = titleAndContent[0] | replace_first: \'>\', \'<h1>\' | split: \'<h1>\' -%}
{%- assign title = title[1] | strip_html -%}
@ -47,7 +60,7 @@ permalink: /assets/js/search-data.json
"doc": {{ page.title | jsonify }},
"title": {{ title | jsonify }},
"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 }},
"url": "{{ url | absolute_url }}",
"url": "{{ url | relative_url }}",
"relUrl": "{{ url }}"
}
{%- assign i = i | plus: 1 -%}
@ -58,13 +71,14 @@ permalink: /assets/js/search-data.json
"doc": {{ page.title | jsonify }},
"title": {{ page.title | jsonify }},
"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 }},
"url": "{{ page.url | absolute_url }}",
"url": "{{ page.url | relative_url }}",
"relUrl": "{{ page.url }}"
}
{%- assign i = i | plus: 1 -%}
{%- endunless -%}
{%- endif -%}
{% endfor %}
{%- endfor -%}
{%- endfor %}
}'
end
puts 'Done.'

6
package-lock.json generated
View File

@ -3753,9 +3753,9 @@
"dev": true
},
"prettier": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz",
"integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz",
"integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==",
"dev": true
},
"prettier-linter-helpers": {

View File

@ -1,13 +1,13 @@
{
"name": "just-the-docs",
"version": "0.3.1",
"version": "0.3.2",
"description": "A modern Jekyll theme for documentation",
"repository": "pmarsceill/just-the-docs",
"license": "MIT",
"bugs": "https://github.com/pmarsceill/just-the-docs/issues",
"devDependencies": {
"@primer/css": "^15.1.0",
"prettier": "^2.0.5",
"prettier": "^2.1.1",
"stylelint": "^13.6.1",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-primer": "^9.0.0",