144 Commits

Author SHA1 Message Date
Peter Mosses
dd0b814bfd
Docs: Allow unlimited multi-level navigation (#1440)
* Remove `jekyll-default-layout` plugin

* Move docs/navigation-structure to docs/navigation

* Fix uses of line-nos in md files

* Update CHANGELOG.md

---------

Co-authored-by: Matt Wang <matt@matthewwang.me>
2024-08-20 22:50:47 +02:00
Peter Mosses
a4e4e312aa
Feature: Allow unlimited multi-level navigation (#1431)
* Allow unlimited multi-level navigation

This PR supersedes #462.

The only user-level difference from #462 is that disambiguation of parent pages has to use either `grand_parent` or `ancestor` titles: the somewhat unnatural `section_id` and `in_section` fields are not supported.

The implementation has been significantly simplified by the changes introduced in v0.7.0 of the theme.

* Detect cyclic parenthood

A page should not have a parent or ancestor with the same title. If it does, the location of the repeated link is marked by ∞, to facilitate debugging the navigation (and an unbounded loop leading to a build exception is avoided).

* Add nav_error_report warning in main navigation

When activated by `nav_error_report: true` in `_config.yml`, displays warnings about pages with the same title as their parent page or an ancestral page.

* Cache site-nav with links to all pages

The extra cached site-nav is used for determining breadcrumbs and children navigation, which may involve pages that are excluded from the main navigation.

* Replace code for determining children by inclusion of components/nav/children.html

* Update CHANGELOG.md

---------

Co-authored-by: Matt Wang <matt@matthewwang.me>
2024-08-20 22:34:11 +02:00
Matt Wang
ac78bfea6c
Fix CHANGELOG typo
🤦
2024-08-12 12:27:06 -07:00
Matt Wang
3974fb87e2
Prep: 0.9.0 2024-08-12 12:21:46 -07:00
Matt Wang
060bb31a78
Apply Stylelint to vendor/ code, fix errors (#1508)
Changes are in three categories:

- whitespace
- devendoring prefixes for properties that have entered the CSS spec - reasonable to autofix
- removing a duplicate `monospace` in `monospace, monospace` `font-family` decl in normalize.scss - not autofix
2024-08-12 12:10:00 -07:00
Bob van de Vijver
9aa1eeac3c
Fix Sass mixed declarations (#1495)
As requested (https://github.com/just-the-docs/just-the-docs/issues/1493#issuecomment-2227203330), a PR to resolve the Sass deprecations. Seems to solve all deprecations I am seeing, and I am not seeing any weird changes in the resulting CSS file.

Closes #1493.

<details>
<summary>Git diff of generated CSS file</summary>


```patch
diff --git a/just-the-docs-default.css b/just-the-docs-default.css.new
index fe42b2d..50a103b 100644
--- a/just-the-docs-default.css
+++ b/just-the-docs-default.css.new
@@ -591,9 +591,11 @@ template {
 }

 html {
-  font-size: 0.875rem !important;
   scroll-behavior: smooth;
 }
+html {
+  font-size: 0.875rem !important;
+}
 @media (min-width: 31.25rem) {
   html {
     font-size: 1rem !important;
@@ -715,25 +717,50 @@ blockquote {
     min-width: 16.5rem;
   }
 }
-
 @media (min-width: 50rem) {
-  .main {
-    position: relative;
-    max-width: 50rem;
+  .side-bar + .main {
     margin-left: 15.5rem;
   }
 }
 @media (min-width: 66.5rem) {
-  .main {
+  .side-bar + .main {
     margin-left: max(16.5rem, (100% - 66.5rem) / 2 + 16.5rem);
   }
 }
+.side-bar + .main .main-header {
+  display: none;
+  background-color: #f5f6fa;
+}
+@media (min-width: 50rem) {
+  .side-bar + .main .main-header {
+    display: flex;
+    background-color: #fff;
+  }
+}
+.side-bar + .main .main-header.nav-open {
+  display: block;
+}
+@media (min-width: 50rem) {
+  .side-bar + .main .main-header.nav-open {
+    display: flex;
+  }
+}
+
+.main {
+  margin: auto;
+}
+@media (min-width: 50rem) {
+  .main {
+    position: relative;
+    max-width: 50rem;
+  }
+}

 .main-content-wrap {
-  padding-right: 1rem;
-  padding-left: 1rem;
   padding-top: 1rem;
   padding-bottom: 1rem;
+  padding-right: 1rem;
+  padding-left: 1rem;
 }
 @media (min-width: 50rem) {
   .main-content-wrap {
@@ -750,24 +777,13 @@ blockquote {

 .main-header {
   z-index: 0;
-  display: none;
-  background-color: #f5f6fa;
+  border-bottom: 1px solid #eeebee;
 }
 @media (min-width: 50rem) {
   .main-header {
     display: flex;
     justify-content: space-between;
     height: 3.75rem;
-    background-color: #fff;
-    border-bottom: 1px solid #eeebee;
-  }
-}
-.main-header.nav-open {
-  display: block;
-}
-@media (min-width: 50rem) {
-  .main-header.nav-open {
-    display: flex;
   }
 }

@@ -814,8 +830,6 @@ blockquote {
 }

 .site-title {
-  padding-right: 1rem;
-  padding-left: 1rem;
   flex-grow: 1;
   display: flex;
   height: 100%;
@@ -823,7 +837,8 @@ blockquote {
   padding-top: 0.75rem;
   padding-bottom: 0.75rem;
   color: #27262b;
-  font-size: 1.125rem !important;
+  padding-right: 1rem;
+  padding-left: 1rem;
 }
 @media (min-width: 50rem) {
   .site-title {
@@ -831,6 +846,9 @@ blockquote {
     padding-left: 2rem;
   }
 }
+.site-title {
+  font-size: 1.125rem !important;
+}
 @media (min-width: 31.25rem) {
   .site-title {
     font-size: 1.5rem !important;
@@ -877,15 +895,14 @@ body {
 }

 .site-footer {
-  padding-right: 1rem;
-  padding-left: 1rem;
   position: absolute;
   bottom: 0;
   left: 0;
   padding-top: 1rem;
   padding-bottom: 1rem;
   color: #959396;
-  font-size: 0.6875rem !important;
+  padding-right: 1rem;
+  padding-left: 1rem;
 }
 @media (min-width: 50rem) {
   .site-footer {
@@ -893,6 +910,9 @@ body {
     padding-left: 2rem;
   }
 }
+.site-footer {
+  font-size: 0.6875rem !important;
+}
 @media (min-width: 31.25rem) {
   .site-footer {
     font-size: 0.75rem !important;
@@ -948,6 +968,8 @@ body {
   color: #959396;
   content: counter(step-counter);
   counter-increment: step-counter;
+}
+.main-content ol > li::before {
   font-size: 0.75rem !important;
 }
 @media (min-width: 31.25rem) {
@@ -1150,10 +1172,12 @@ body {
   list-style: none;
 }
 .nav-list .nav-list-item {
-  font-size: 0.875rem !important;
   position: relative;
   margin: 0;
 }
+.nav-list .nav-list-item {
+  font-size: 0.875rem !important;
+}
 @media (min-width: 31.25rem) {
   .nav-list .nav-list-item {
     font-size: 1rem !important;
@@ -1246,6 +1270,8 @@ body {
   text-align: start;
   text-transform: uppercase;
   border-bottom: 1px solid #eeebee;
+}
+.nav-category {
   font-size: 0.6875rem !important;
 }
 @media (min-width: 31.25rem) {
@@ -1280,6 +1306,8 @@ body {
 .aux-nav {
   height: 100%;
   overflow-x: auto;
+}
+.aux-nav {
   font-size: 0.6875rem !important;
 }
 @media (min-width: 31.25rem) {
@@ -1320,6 +1348,8 @@ body {

 .breadcrumb-nav-list-item {
   display: table-cell;
+}
+.breadcrumb-nav-list-item {
   font-size: 0.6875rem !important;
 }
 @media (min-width: 31.25rem) {
@@ -1341,11 +1371,14 @@ body {
   content: "";
 }

+h1,
+.text-alpha {
+  font-weight: 300;
+}
 h1,
 .text-alpha {
   font-size: 2rem !important;
   line-height: 1.25;
-  font-weight: 300;
 }
 @media (min-width: 31.25rem) {
   h1,
@@ -1381,11 +1414,14 @@ h3,

 h4,
 .text-delta {
-  font-size: 0.6875rem !important;
   font-weight: 400;
   text-transform: uppercase;
   letter-spacing: 0.1em;
 }
+h4,
+.text-delta {
+  font-size: 0.6875rem !important;
+}
 @media (min-width: 31.25rem) {
   h4,
   .text-delta {
@@ -1454,9 +1490,12 @@ h6,
   text-transform: uppercase;
   vertical-align: middle;
   background-color: #2869e6;
-  font-size: 0.6875rem !important;
   border-radius: 12px;
 }
+.label:not(g),
+.label-blue:not(g) {
+  font-size: 0.6875rem !important;
+}
 @media (min-width: 31.25rem) {
   .label:not(g),
   .label-blue:not(g) {
@@ -1752,6 +1791,8 @@ h6,
   padding-left: 0;
   margin-bottom: 0.25rem;
   list-style: none;
+}
+.search-results-list {
   font-size: 0.875rem !important;
 }
 @media (min-width: 31.25rem) {
@@ -1804,6 +1845,8 @@ h6,
 }
 .search-result-doc.search-result-doc-parent {
   opacity: 0.5;
+}
+.search-result-doc.search-result-doc-parent {
   font-size: 0.75rem !important;
 }
 @media (min-width: 31.25rem) {
@@ -1844,6 +1887,8 @@ h6,
   color: #959396;
   text-overflow: ellipsis;
   white-space: nowrap;
+}
+.search-result-rel-url {
   font-size: 0.5625rem !important;
 }
 @media (min-width: 31.25rem) {
@@ -1862,6 +1907,8 @@ h6,
   word-wrap: break-word;
   border-left: 1px solid;
   border-left-color: #eeebee;
+}
+.search-result-previews {
   font-size: 0.6875rem !important;
 }
 @media (min-width: 31.25rem) {
@@ -1889,6 +1936,8 @@ h6,

 .search-no-result {
   padding: 0.5rem 0.75rem;
+}
+.search-no-result {
   font-size: 0.75rem !important;
 }
 @media (min-width: 31.25rem) {
@@ -1998,13 +2047,16 @@ table {

 th,
 td {
-  font-size: 0.75rem !important;
   min-width: 7.5rem;
   padding: 0.5rem 0.75rem;
   background-color: #fff;
   border-bottom: 1px solid rgba(238, 235, 238, 0.5);
   border-left: 1px solid #eeebee;
 }
+th,
+td {
+  font-size: 0.75rem !important;
+}
 @media (min-width: 31.25rem) {
   th,
   td {
@@ -2135,12 +2187,15 @@ figure.highlight :not(pre) > code {
 }
 .highlight .table-wrapper td,
 .highlight .table-wrapper pre {
-  font-size: 0.6875rem !important;
   min-width: 0;
   padding: 0;
   background-color: #f5f6fa;
   border: 0;
 }
+.highlight .table-wrapper td,
+.highlight .table-wrapper pre {
+  font-size: 0.6875rem !important;
+}
 @media (min-width: 31.25rem) {
   .highlight .table-wrapper td,
   .highlight .table-wrapper pre {
```
</details>
2024-08-12 11:34:20 -07:00
Matt Wang
2dd535c2da
Fix: protect search-data.json file from front matter default for layout (#1468)
Fixes #1466. Prior art: #1447. Otherwise self-explanatory.

To test:

1. First, clone [template repository](https://github.com/just-the-docs/just-the-docs-template/tree/main). Observe that search works.
2. Next, add a default layout to all files
```yml
defaults:
  - scope:
      path: ""
    values:
      layout: "default"
```
3. Observe that search no longer works.
4. Apply this patch
5. Observe that search works again!
2024-05-15 17:06:27 -07:00
Kevin Lin
a251382b7a
Add nav_enabled variables for more customizable and feature-complete minimal layouts (#1441)
* Add nav_enabled variables for site/layout/page-level control

* _sass: Add a space around `+` operator

* assets: Do not compile based on site.nav_enabled

* _config.yml: nav_enabled can be selectively enabled

* CHANGELOG.md: Add nav_enabled feature and docs

* docs: Prefer em dash in describing minimal layout

* docs: Add section on Selectively hiding or showing the sidebar

* _layouts: Display sidebar based on variable importance

* docs: Update documentation on the minimal layout

* docs: Document site.nav_enabled configuration variable

---------

Co-authored-by: Matt Wang <matt@matthewwang.me>
2024-04-22 15:07:29 -07:00
Matt Wang
e434f916ce
Prep 0.8.2 2024-04-01 11:25:25 -07:00
Peter Mosses
328893dd30
Fix: Protect theme JS file from front matter default for layout (#1447)
Fix #1445

Front matter defaults with unrestricted `scope` (`path: ""`) can affect theme code files. [Jekyll](https://jekyllrb.com/docs/front-matter/#predefined-global-variables) supports using `null` to "produce a file without using a layout file".

This PR adds `layout: null` to `just-the-docs.js`, to avoid this file being affected by the following front matter defaults:

```yaml
defaults:
  -
    scope:
      path: ""
    values:
      layout: "default"
```
2024-04-01 19:59:07 +02:00
Matt Wang
930a0e0c36
Prep 0.8.1 2024-03-06 14:50:44 -08:00
Jos Ahrens
880f4dc8b0
Build docs site using strict mode and strict_filters (#1435)
Ref: https://github.com/just-the-docs/just-the-docs/pull/1434#issuecomment-1981666074
2024-03-06 14:48:00 -08:00
Jos Ahrens
15a0b6e91b
Fix Liquid filter typo in breadcrumb component (strip instead of trim) (#1434)
We are running into an issue upgrading from 0.7 to 0.8, suggesting that `trim` is not a method.

```
1.963   Liquid Exception: Liquid error (/usr/gem/gems/just-the-docs-0.8.0/_includes/components/breadcrumbs.html line 59): undefined filter trim included in /_layouts/default.html
1.968 /usr/gem/gems/liquid-4.0.4/lib/liquid/strainer.rb:58:in `invoke': Liquid error (/usr/gem/gems/just-the-docs-0.8.0/_includes/components/breadcrumbs.html line 59): undefined filter trim included  (Liquid::UndefinedFilter)
```
Looking at the liquid docs, we're probably looking for `strip` and not `trim`

https://shopify.github.io/liquid/filters/strip/

https://github.com/Shopify/liquid/blob/main/History.md#300--2014-11-12, I don't see a trim so it may have been an extension? This does work normally on just-the-docs itself running from scratch, so it might also be a bug in our application (or combination of different versions in plugins).
2024-03-06 14:39:45 -08:00
Matthew Wang
6fc71c108b
Prep 0.8.0 2024-02-22 22:05:07 -08:00
Peter Mosses
820d256bcd
Quicker build (#1397)
This PR uses the cached site-nav to determine the position of each page in the navigation hierarchy. [Profiling](https://just-the-docs.github.io/just-the-docs-tests/tests/profiles/index/) shows that it significantly reduces the v0.7.0 build time for larger sites – especially with Jekyll 3. The improvement is due mainly to the elimination of loops and filters that depended on the entire site. 

For example:

- [endoflife.date](https://just-the-docs.github.io/just-the-docs-tests/tests/profiles/endoflife.date/index/) drops from 32s to 11s
- [machinetranslate.org](https://just-the-docs.github.io/just-the-docs-tests/tests/profiles/machinetranslate.org/index/) drops from 267s to ~~73s~~ 56s

### Testing

[Just the Docs Tests](https://just-the-docs.github.io/just-the-docs-tests/) is currently built using this PR branch. With JS disabled, the highlighting and unfolding of the navigation panel should be as with v0.7.0.

A diff of the tests site built with this PR branch compared to v0.7.0 should report no significant changes. For more rigorous testing, diffs of variants of the tests site should also be inspected.
2024-02-22 21:56:52 -08:00
Roman KC
01719a8752
Add configurable keyboard shortcut to focus search input (#1411)
Adds a keyboard shortcut to use Ctrl/Cmd and a configurable key to focus the search input. The key is configurable with `search.focus_shortcut_key`; enables it on the core docs site with `'k'` (default on many sites).

---------
Co-authored-by: Matt Wang <mxw@cs.washington.edu>
2024-02-21 20:43:45 +00:00
Peter Mosses
742281635f
Fix navigation when .html omitted (#1374)
* Prefer exact match of pathname
* Update CHANGELOG.md
2024-01-25 18:02:39 +01:00
Matt Wang
da38718d7a
Fix incorrect positioning of clickable area for navigation links on Safari (#1403)
Closes #1392.

Unfortunately, this PR has not actually diagnosed the root problem with the `scrollBy` calculation/method and Safari. However, by using the [`scrollIntoView`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) function (which essentially does what the calculation was meant to do), this problem is "magically" solved! As a side effect, I think this makes the code easier to maintain (I myself was thinking: why is there a magic `3` multiplier?). 

~~I will point out that this does change *how much is scrolled*; following the spec for the method, the sidebar is now scrolled so that the active navigation link is top-aligned with the scroll container (which in this case, is the navigation sidebar's "cutoff"). I personally am fine with this change, but happy to fiddle around (e.g. we could vertically align to the `center` via [`scrollIntoViewOptions`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView#parameters), though I'm not sure if this causes compatability problems).~~

I will point out that this does change *how much is scrolled*; we are now using the `center` option to `scrollBy`, which centers the target link. As Peter has commented in the PR thread, this seems to be the best compromise for maintaining the spirit of the previous calculation.

### testing

Peter did a great job writing a reproducible bug report in #1392. To test this, 

1. first, follow the instructions verbatim on `main`. observe that the bug appears on Safari on macOS, but not Firefox and Chrome
2. then, apply this change (e.g. check out the branch)
3. next, replay the instructions - observing that
    1. the bug is fixed on Safari
    2. there is no change to the behaviour on Firefox and Chrome (other than the "start" of the scroll")

### compatability

On [Can I use](https://caniuse.com/scrollintoview), `scrollIntoView` has 98.15% adoption (the only "major" holdout being Opera Mini); and, the partial support from IE is about an option that we don't use. So, I'm pretty confident that we should be able to roll out this change without our users being locked out by a new-ish method.
2024-01-01 14:19:24 -08:00
Matthew
b12ed38e7b
Update CHANGELOG 2023-12-18 10:00:50 -08:00
Matthew
a387ea12a8
Prep 0.7.0 2023-10-25 12:03:04 -07:00
Matt Wang
80bd7bfc9f
Fix accidental disabling of forward-declared stylesheets (#1373)
PR for the issue flagged in https://github.com/just-the-docs/just-the-docs/discussions/1359#discussioncomment-7267686 (and related to #1358, #1350, etc.). This PR essentially just disables the `head-nav` stylesheet by ID instead of relying on the index; this makes the code more robust against stylesheets that are arbitrarily entered into the document (such as by JavaScript, which is the case of #1359).
2023-10-25 11:52:44 -07:00
Peter Mosses
56e0f1c800
Fix invalid CSS rules in head elements (#1368)
Rectify and simplify CSS rules  used in the head element. The rules now avoid the invalid use of nested `:not()` pseudo-classes.

- Update CHANGELOG.md
- Remove ignore statements re CSS parse errors
- Add rules for excluded pages and simplify
- Add `activation_no_nav_link` with the rules for excluded pages
- Insert `activation_no_nav_link` when no other rules are generated
- Replace `:nth-child(1)` by `:first-child`
- Correct `:nth-child(n + {{ activation_index | plus: 1 }})` to `:not(:first-child)`
- Eliminate `activation_collection_index`
- Generate `.nav-category-list` selectors only for sites with collections

---------

Co-authored-by: Matt Wang <matt@matthewwang.me>
2023-10-25 18:22:18 +01:00
Matthew
fad37122ae
Update Changelog 2023-10-20 15:36:25 -07:00
Susheel Thapa
cdae4f63d5
docs: fix typos in CHANGELOG and MIGRATION (#1377)
This PR fixed the typos in CHANGELOG and MIGRATION files

```pseudo
Simlar > Similar
avaialble > available
vulnerablities > vulnerabilities
concering > concerning
```
2023-10-20 11:34:40 -07:00
Peter Mosses
ae52352eae
Fixed: navigation scroll to active link regression (#1367)
* Defer removal of href

The `href` with the URL of the current page is inspected by `navLink()`, so it should not be removed until after the calls of `navLink()` in `scrollNav()` and `activateNav()`.

As `scrollNav()` follows `activateNav()`, the removal of `href` needs to be left to `scrollNav()`.

* Update CHANGELOG.md
2023-10-08 10:37:24 +02:00
Matt Wang
66b84a03e7
Fixes erroneous parentheses in site_nav conditional (#1366)
Ref: https://github.com/just-the-docs/just-the-docs/pull/1360#issuecomment-1751358990.

I'm sorry for not catching this earlier; I'm surprised that this slipped my mind (maybe I'm juggling too many templating languages).

Though, also, I'm surprised that this doesn't flag as a compiler error?
2023-10-06 15:37:27 -07:00
CarbonNeuron
33ba8d8eaa
Add configuration options for opening external links in new tab (#1360)
I've whipped up a solution that solves #1103. I've added a config option `nav_external_links_new_tab`, which is off by default. When turned on, it'll pop external nav links into a new tab. The idea was borrowed from how [aux_nav.html](https://github.com/just-the-docs/just-the-docs/blob/main/_includes/components/aux_nav.html) does it with `aux_links_new_tab`.

---------

Co-authored-by: Matt Wang <matt@matthewwang.me>
2023-10-04 12:10:56 -07:00
Peter Mosses
2ccc451c2a
Fix: improve build time (#1358)
* Remove "passive" toggle

PR #1244 introduced the "passive" toggle, but just-the-docs.js subsequently disabled the only styling that used it, so it became redundant.
This removes it.

* Reduce build time for page-dependent CSS

Fix #1323

- Remove `_includes/head_nav.html`.
- Generate page-independent SCSS in `assets/css/just-the-docs-head-nav.css`.
- Link to `/assets/css/just-the-docs-head-nav.css` in `head.html`.
- Disable the above stylesheet in `assets/js/just-the-docs.js`.
- Generate page-dependent CSS in `_includes/css/activation.scss.liquid` and include in `head.html`.

* No override svg rotate

* Disable both stylesheets safely

* Move the site nav to a new include

- Fix the complete site nav
- Move the site nav to `_includes/site_nav.html`
- Cache the site nav
- Uncache `nav.html`

* Move nav and site_nav to _includes/components

* Replace id prefix

* Update breadcrumbs.html

Replace several filters by a single loop through all the pages,
but breaking as soon as possible.

Profiling indicates that this saves up to 50% of the breadcrumbs build time for the filters.

* Update just-the-docs-head-nav.css

Adjust the number of lines to keep

* Update head.html

Remove superflous type.

* Update activation.scss.liquid

Remove a superfluous closing brace.
Adjust layout.

* Use `scssify` to remove nesting

Preliminary profiling indicates that using `scssify` on the small number of nested CSS rules produced by `activation.scss.liquid` is quick enough.

* Update head.scss

Manual attempt at prettier (pending installation in Atom).

* Avoid generation of nested CSS

Local profiling indicated that using `scssify` on each page takes about 1% of the build time.

- Update `_includes/css/activation.scss.liquid` to generate non-nested CSS.
- Remove use of `scssify` from `_includes/head.html`.

* Ignore false positives from validator

Ignores: `:1.810-1.823: error: CSS: Parse Error.` and `:1.811-1.824: error: CSS: Parse Error.`; had to shift things around since the local config overrides the CI flag.

* Inline `_sass/head.css`

* Update CHANGELOG.md

---------

Co-authored-by: Matthew Wang <matt@matthewwang.me>
2023-10-01 14:47:26 +02:00
Peter Mosses
cd4f1b02b2
Remove href from the navigation link to the current page (#1356)
* Remove href from link to active page

* Update CHANGELOG.md

Co-authored-by: Matt Wang <matt@matthewwang.me>

---------

Co-authored-by: Matt Wang <matt@matthewwang.me>
2023-09-29 22:33:15 +02:00
Matthew Wang
22fc061ef4
0.6.2 2023-09-19 17:26:18 -07:00
Peter Mosses
0964e1f8ae
Remove the passive toggle (#1335)
* Remove "passive" toggle

PR #1244 introduced the "passive" toggle, but just-the-docs.js subsequently disabled the only styling that used it, so it became redundant.
This removes it.

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Matt Wang <matt@matthewwang.me>

* Update CHANGELOG.md

Co-authored-by: Matt Wang <matt@matthewwang.me>

---------

Co-authored-by: Matt Wang <matt@matthewwang.me>
2023-09-06 22:20:26 +02:00
Matthew Wang
bebaee046a
Update CHANGELOG.md 2023-08-30 10:14:43 -07:00
Matthew Wang
3a205e545c
Fix typo in Changelog 2023-08-26 13:36:37 -04:00
Matthew Wang
cef1203301
v0.6.1 2023-08-26 13:33:17 -04:00
Matthew Wang
7b181153a8
Prep v0.6.0 2023-08-19 21:57:45 -04:00
Peter Mosses
9d0ce1c22a
Fix the navigation panel (#1244)
* Fix the nav html and cache it

- Remove `active` class from nav html
- Add js to insert `active` class on link to selected page
- Include attempt to generate page-specific css for same styling when js is off

* Refactor nav, breadcrumbs, children_nav

Fix #1118

Improve the modularity of building the nav-panel, breadcrumbs, and children-nav
by making them independent. This also significantly simplifies the Liquid code.

* Manual merge of fix-leakage

Also fix order of breadcrumbs

* Fix order of breadcrumbs

* Revert layout in HTML

Revert to the previous layout in the HTML, to allow the use of `diff` to check the built site.

* Update breadcrumbs.html

Revert inclusion of single breadcrumb for top-level pages.

* Update breadcrumbs.html

Revert to the previous layout in the HTML, to allow the use of `diff` to check the built site.

* Update children_nav.html

Revert to the previous layout in the HTML, to allow the use of `diff` to check the built site.

* Delete nav_init.html

* Update sidebar.html

Caches.

* Add a comment

* Update nav.html

- Comment on independence from page.
- Remove redundant comment.
- Remove superfluous conditionals.

* Update just-the-docs.gemspec

Revert jekyll version spec change.

* Update just-the-docs.gemspec

Revert runtime dependency on kramdown-parser-gfm.

* Revert inclusion of activation.scss.liquid

Inclusion makes HTML of all pages differ from 0.5.1

* Update default.html

Restore deleted "<!DOCTYPE html>"

* Update children_nav.html

Restore line break.

* Delete activation.scss.liquid

This was merely an example of page-specific CSS for use when JS off.

* Remove an unused include parameter

`nav.html` does not depend on `include.key`.

* Generate page-specific styling for nav links and lists in the side-nav

In this PR, the code in `includes/nav.html` is fixed, and none of its elements have class `active`. When JS is enabled, `activateNav()` adds the class `active` to all nav-list-items that enclose the nav-list-link to the current page, so the navigation works as usual. Unobtrusive JS requires the same behaviour when JS is disabled.

- Add `_includes/css/activation.scss.liquid` to compute the indices in the enclosing nav-lists of the nav-list-link to the current page, and generate page-specific styling.
- Insert Liquid code in `_includes/head.html` to include the CSS generated by `_includes/css/activation.scss.liquid` (which depends on `site.color_scheme`).
- Update the toggling in `initNav()` to allow also contraction of enclosing levels when JS is enabled.

Caveat: When JS is enabled, buttons can be used to switch the colour scheme dynamically. The page-specific styling of the site-nav is generated statically, and doesn't change, so the background-image of the nav-list-link to the current page is incorrect. (I guess that could be fixed by generating a style element for each available colour scheme, and using JS to reorder the stylesheets in the DOM.)

A further issue is that the `@import` rules used in `_includes/head.html` cause duplication. Replacing them by `@use` rules would avoid duplication, but that is out of scope for this PR.

* Fix activation for collections

- Adjust generated selectors to pages in collections.
- Expand all folded collections when JS is disabled.

This PR should now make unobtrusive use of JS:

- When JS is disabled, the navigation panel shows links to the top pages in all collections (in contrast to the current version of the theme).
- When JS is enabled, folded collections remain folded until their pages are selected.

* Respect `child_nav_order`

- Assumes reverse order when set to any truthy value.

* Suppress liquid line breaks

* Cache the search for favicon.ico

- Move the code for finding the favicon.ico file to `_includes/favicon.html`.
- Replace that code in `_includes.html` by a cached include of `favicon.html`.

* Add "jekyll-include-cache" in fixtures

Needed when CI ignores the gemspec.

* Add gem "jekyll-include-cache" in fixtures

Needed when CI ignores the gemspec.

* Update head.html

- Avoid duplication of color_scheme CSS in `style` element.
- Avoid generation of whitespace by Liquid code.

* Update sorted_pages.html

- Minor optimisation.
- Minor improvements to layout of Liquid code.

* Ensure split is not at start of rules generated by css/activation.scss.liquid

A custom color scheme might not import any highlighting style rules, so we should not assume that there is anything before the first occurrence of `.site-nav`.

* Update head.html

- Add implicit import of light color scheme.
- Revert to previous Liquid code for removing color scheme rules.

* Manual resolution of merge conflicts with v0.5.2

- Copied replacement of links on nav expanders by buttons.
- Removed (page-dependent) conditions associated with `active`.

* Manual resolution of merge conflict with v0.5.2

If previously "" (neither active nor passive), then `active && passive` is true, and the target is now "active".
If previously only "active", then the target is now just "passive".
If previously only "passive", then the target is now just "active".
The state "active passive" is never used.
The value of `active` is true just when the target is left "active".

* Update fixtures/Gemfile-github-pages

Co-authored-by: Matt Wang <matt@matthewwang.me>

* Update head.html

The result of `activation.scss.liquid` is "" for pages with no `title` or with `nav_exclude`. This update  stops `head.html`  including a `style` element with an invalid body on such pages.

Note that when the result of `scssify` doesn't contain `.site-nav`, `split` produces a one-element array, so `shift` produces an empty array, and `join` then produces an empty string.

* Fix omitted `.site-nav`

Restore the previous prepending of `.site-nav`, which was dropped when suppressing the generation of an incorrect `<style>` element for pages excluded from the navigation.

* Add a footnote about `.site-nav`

* Make setTheme remove background images from nav links

With a fixed nav panel, a <style> in the <head> sets a background image to highlight the nav list link to the current page. The image color depends on site.color_scheme.

Ideally, setTheme(theme) would change the image color to match the theme/scheme. Here, for simplicity, we merely remove the image.

* Explain `nav_fold` in collections.

* Refactor

Attempt at cleaning up the duplicated nav links code and simplifying removal of the background image:

* Add function `navLink()`
* Replace `removeNavBackgroundImages()` by `removeNavBackgroundImage()`
* Replace var `siteNav` by `document.getElementById('site-nav')`
* Replace code in `scrollNav` and `activateNav` by `navLink()`
* Replace a (non-local!) reference to `siteNav` by `document`

* Disable the page-specific stylesheet when JS is enabled

The page-specific `<style>` in the `<head>` is needed only when JS is disabled. Moreover, it incorrectly overrides dynamic stylesheets set by setTheme(theme).

The page-specific stylesheet is assumed to have index 1 in the list of stylesheets. It would be safer to select it by `id`, but adding an `id` can break existing sites.

* Avoid constraint on use of `.site-nav`, and refactor

Avoid the constraint on use of `.site-nav` by determining how many occurrences are produced by `css/activation.scss.liquid` when custom color schemes are ignored.

Move the Liquid code used for generating the page-dependent style element to a new include `head_nav.html`, to simplify `head.html`.

Remove the footnote about `.site-nav` in `docs/customization.md`.

Test the styling with JS disabled, since the resulting style element is disabled by JS.

* Revert "Avoid constraint on use of `.site-nav`, and refactor"

This reverts commit 5284892a7486ef9d2af9929c8a509b89731bb233.

* Avoid constraint on use of `.site-nav`, and refactor

(This corrects a bug in the previous reverted commit for excluded pages such as 404.html.)

Avoid the constraint on use of `.site-nav` by determining how many occurrences are produced by `css/activation.scss.liquid` when custom color schemes are ignored.

Move the Liquid code used for generating the page-dependent style element to a new include `head_nav.html`, to simplify `head.html`.

Remove the footnote about `.site-nav` in `docs/customization.md`.

Test the styling with JS disabled, since the resulting style element is disabled by JS.

* Update comment

* Fix duplicate plugins setting

@mattxwang noticed that the second `plugins` setting was apparently overriding the first, leading to a missing plugin when using `fixtures/Gemfile-github-pages`.

* Avoid double inclusion of activation file

The previous changes to remove the constraint re ".site-nav" duplicated the inclusion of `css/activation.scss.liquid`.
That caused significant extra build time, which the current changes to `head_nav.html` avoid (without affecting the built site).

* Clarify collection configuration docs

* Update and clarify the CHANGELOG

---------

Co-authored-by: Matt Wang <matt@matthewwang.me>
2023-08-18 20:35:14 +02:00
Matthew Wang
e044134886
Update CHANGELOG 2023-07-28 12:08:16 -04:00
Matt Wang
f246498a8f
Update CHANGELOG.md 2023-07-24 19:13:18 -04:00
Matthew Wang
9959191af1
v0.5.4 2023-07-05 01:05:57 -04:00
Matthew Wang
56c908e995
v0.5.3 2023-06-17 13:38:02 -07:00
Matthew Wang
ea0d5d8ec7
v0.5.2 2023-06-06 21:48:55 -07:00
Matt Wang
790a8b5c06
Update CHANGELOG.md 2023-06-06 19:36:04 -07:00
Matthew Wang
2b1cb67790
Update changelog 2023-05-31 13:39:51 -07:00
Matt Wang
0b93b35a3f
Update canonical site domain to be just-the-docs.com (#1211)
This PR locks in *almost* everything to switch over to [just-the-docs.com](https://just-the-docs.com)!

It:

- replaces all instances to the theme docs site (`https://just-the-docs.github.io/just-the-docs`) with `https://just-the-docs.com`
    - as @max06 has noted below, we do not change other links with the same `.github.io` prefix
- changes the `site.url` and `site.baseurl` in the theme docs' `_config.yml`
- adds a note in both the changelog and migration guide that a frozen version of `v0.3.3` docs is available at [https://v0-3-3-docs.just-the-docs.com/](https://v0-3-3-docs.just-the-docs.com/)

Closes #1160.
2023-05-14 22:06:14 -07:00
Peter Mosses
8e38759613
Fix liquid variable leakage in navigation components (#1243)
* Refactor nav, breadcrumbs, children_nav

Fix #1118

Improve the modularity of building the nav-panel, breadcrumbs, and children-nav
by making them independent. This also significantly simplifies the Liquid code.

* Fix order of breadcrumbs

* Update breadcrumbs.html

Revert inclusion of single breadcrumb for top-level pages.

* Update breadcrumbs.html

* Update children_nav.html

Revert to the previous layout in the HTML, to allow the use of `diff` to check the built site.

* Update minimal.html

Remove the previously required workaround involving `nav.html`.

* Add docs pages about layouts

The aim of the initial version of these docs pages is to illustrate the difference between the default and minimal layouts.

* Update CHANGELOG.md
2023-05-09 17:57:26 +02:00
Matthew Wang
aaf5a68154
Prep v0.5.1 2023-04-25 09:51:08 -07:00
Matt Wang
a9bced2f26
Update CHANGELOG.md 2023-04-22 13:39:09 -07:00
Matt Wang
d107faaff4
Update CHANGELOG.md (#1231) 2023-04-19 23:07:05 -07:00
Matthew Wang
6a6cc20620
Prep v0.5.0 2023-04-12 12:38:17 -07:00
Matt Wang
786678a6a2
Update CHANGELOG.md 2023-04-11 17:29:37 -07:00