jekyll-awesome-nav 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.copier-answers.ci.yml +12 -0
  3. data/.devcontainer/devcontainer.json +35 -0
  4. data/.devcontainer/post-create.sh +19 -0
  5. data/.rubocop.yml +43 -0
  6. data/.ruby-version +1 -0
  7. data/.vscode/tasks.json +70 -0
  8. data/AGENTS.md +287 -0
  9. data/CODE_OF_CONDUCT.md +84 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +176 -0
  12. data/Rakefile +11 -0
  13. data/jekyll-awesome-nav.gemspec +35 -0
  14. data/lib/jekyll/awesome_nav/config.rb +31 -0
  15. data/lib/jekyll/awesome_nav/generator.rb +50 -0
  16. data/lib/jekyll/awesome_nav/nav_file.rb +14 -0
  17. data/lib/jekyll/awesome_nav/nav_file_loader.rb +140 -0
  18. data/lib/jekyll/awesome_nav/nav_file_options.rb +69 -0
  19. data/lib/jekyll/awesome_nav/nav_resolver.rb +370 -0
  20. data/lib/jekyll/awesome_nav/navigation_result.rb +150 -0
  21. data/lib/jekyll/awesome_nav/node.rb +64 -0
  22. data/lib/jekyll/awesome_nav/page_set.rb +31 -0
  23. data/lib/jekyll/awesome_nav/serializer.rb +26 -0
  24. data/lib/jekyll/awesome_nav/sort_options.rb +91 -0
  25. data/lib/jekyll/awesome_nav/tree_builder.rb +75 -0
  26. data/lib/jekyll/awesome_nav/utils.rb +94 -0
  27. data/lib/jekyll/awesome_nav/version.rb +19 -0
  28. data/lib/jekyll/awesome_nav.rb +26 -0
  29. data/lib/jekyll-awesome-nav.rb +3 -0
  30. data/site/_config.yml +33 -0
  31. data/site/_includes/awesome-nav-demo-tree.html +15 -0
  32. data/site/_includes/awesome-nav-tree.html +19 -0
  33. data/site/_layouts/awesome_nav_demo.html +128 -0
  34. data/site/docs/getting-started.md +68 -0
  35. data/site/docs/guides/.nav.yml +7 -0
  36. data/site/docs/guides/config.md +37 -0
  37. data/site/docs/guides/data.md +40 -0
  38. data/site/docs/guides/index.md +15 -0
  39. data/site/docs/guides/install.md +53 -0
  40. data/site/docs/guides/layouts.md +116 -0
  41. data/site/docs/guides/overrides.md +42 -0
  42. data/site/docs/index.md +35 -0
  43. data/site/index.md +66 -0
  44. metadata +111 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4d260f9f2584da9eadd23954eeaea7886a7b4aa76a9ff7ea5e51b96f0968a35c
4
+ data.tar.gz: fc44438a6db69080c36db2b6d01613438f4d8561d7d7f4b10720ed29f0c15e1a
5
+ SHA512:
6
+ metadata.gz: a2a84a0bbddfb75659facdd03ab3d0561ad4be3cd5e762fe2742501f6bcec9149d521c32b897c05a258c8a719975507e553cbefc73c115801d8f48ea795d7e24
7
+ data.tar.gz: e141a89da191d1444cdbbf6d23906b4bf7361fb9f782255c4793143a010387c18d98ce90ab62bba19f37444d0c10646885d0de8abe5800ea2f67095abbb4cd6e
@@ -0,0 +1,12 @@
1
+ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2
+ _commit: 7ca8425
3
+ _src_path: gh:athackst/ci
4
+ automerge_mode: poll
5
+ bump_script_path: ''
6
+ do_releases: true
7
+ release_template: '## What''s changed
8
+
9
+
10
+ $CHANGES
11
+ '
12
+ site_generator: none
@@ -0,0 +1,35 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3
+ {
4
+ "name": "Ruby",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ "image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
7
+ "features": {
8
+ "ghcr.io/devcontainers/features/ruby:1": {
9
+ "version": "3.3.4"
10
+ }
11
+ },
12
+ // Features to add to the dev container. More info: https://containers.dev/features.
13
+ // "features": {},
14
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
15
+ "forwardPorts": [
16
+ // Jekyll server
17
+ 4000,
18
+ // Live reload server
19
+ 35729
20
+ ],
21
+ // Use 'postCreateCommand' to run commands after the container is created.
22
+ "postCreateCommand": ".devcontainer/post-create.sh",
23
+ // Configure tool-specific properties.
24
+ "customizations": {
25
+ "vscode": {
26
+ "settings": {
27
+ "rubyLsp.rubyVersionManager": {
28
+ "identifier": "rvm"
29
+ }
30
+ }
31
+ }
32
+ }
33
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
34
+ // "remoteUser": "root"
35
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle config set --local path 'vendor/bundle'
4
+
5
+ # Install the version of Bundler.
6
+ if [ -f Gemfile.lock ] && grep "BUNDLED WITH" Gemfile.lock > /dev/null; then
7
+ cat Gemfile.lock | tail -n 2 | grep -C2 "BUNDLED WITH" | tail -n 1 | xargs gem install bundler -v
8
+ fi
9
+
10
+ # If there's a Gemfile, then run `bundle install`
11
+ # It's assumed that the Gemfile will install Jekyll too
12
+ if [ -f Gemfile ]; then
13
+ bundle install
14
+ fi
15
+
16
+ # Get the current ruby version and set .ruby-version
17
+ ruby_version=$(ruby -v | awk '{print $2}')
18
+ printf %s "$ruby_version" > .ruby-version
19
+ echo "Ruby version $ruby_version set in .ruby-version file"
data/.rubocop.yml ADDED
@@ -0,0 +1,43 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+
5
+ # Naming cops
6
+ # ----------------------------------------
7
+ Naming/FileName:
8
+ Exclude:
9
+ - lib/jekyll-awesome-nav.rb
10
+
11
+ # Layout cops
12
+ # ----------------------------------------
13
+ Layout/LineLength:
14
+ Max: 150
15
+ AllowedPatterns:
16
+ - '\A# '
17
+
18
+ # Metrics cops
19
+ # ----------------------------------------
20
+ Metrics/AbcSize:
21
+ Max: 62
22
+ Metrics/BlockLength:
23
+ Exclude:
24
+ - "test/**/*"
25
+ Metrics/ClassLength:
26
+ Max: 300
27
+ Metrics/CyclomaticComplexity:
28
+ Max: 12
29
+ Metrics/MethodLength:
30
+ Max: 31
31
+ Metrics/ModuleLength:
32
+ Max: 240
33
+ Metrics/ParameterLists:
34
+ Max: 7
35
+ Metrics/PerceivedComplexity:
36
+ Max: 13
37
+
38
+ # Style cops
39
+ # ----------------------------------------
40
+ Style/Documentation:
41
+ Enabled: false
42
+ Style/StringLiterals:
43
+ EnforcedStyle: double_quotes
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.4
@@ -0,0 +1,70 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "label": "Bundle Install",
6
+ "type": "shell",
7
+ "command": "bundle install",
8
+ "options": {
9
+ "cwd": "${workspaceFolder}"
10
+ },
11
+ "problemMatcher": []
12
+ },
13
+ {
14
+ "label": "Test",
15
+ "type": "shell",
16
+ "command": "bundle exec rake test",
17
+ "options": {
18
+ "cwd": "${workspaceFolder}"
19
+ },
20
+ "group": {
21
+ "kind": "test",
22
+ "isDefault": true
23
+ },
24
+ "problemMatcher": []
25
+ },
26
+ {
27
+ "label": "Lint",
28
+ "type": "shell",
29
+ "command": "bundle exec rubocop",
30
+ "options": {
31
+ "cwd": "${workspaceFolder}"
32
+ },
33
+ "group": "build",
34
+ "problemMatcher": []
35
+ },
36
+ {
37
+ "label": "Build Docs Site",
38
+ "type": "shell",
39
+ "command": "bundle exec jekyll build --source site --destination /tmp/jekyll-awesome-nav-site",
40
+ "options": {
41
+ "cwd": "${workspaceFolder}"
42
+ },
43
+ "group": "build",
44
+ "problemMatcher": []
45
+ },
46
+ {
47
+ "label": "Serve Docs Site",
48
+ "type": "shell",
49
+ "command": "bundle exec jekyll serve --source site --destination /tmp/jekyll-awesome-nav-site --livereload",
50
+ "options": {
51
+ "cwd": "${workspaceFolder}"
52
+ },
53
+ "isBackground": true,
54
+ "problemMatcher": {
55
+ "owner": "jekyll",
56
+ "pattern": {
57
+ "regexp": ".",
58
+ "file": 1,
59
+ "location": 1,
60
+ "message": 1
61
+ },
62
+ "background": {
63
+ "activeOnStart": true,
64
+ "beginsPattern": ".*Generating.*",
65
+ "endsPattern": ".*Server address:.*"
66
+ }
67
+ }
68
+ }
69
+ ]
70
+ }
data/AGENTS.md ADDED
@@ -0,0 +1,287 @@
1
+ # AGENTS.md
2
+
3
+ ## Overview
4
+
5
+ This project implements a Jekyll plugin that provides **folder-based navigation with automatic generation and local overrides**, modeled after MkDocs Material + Awesome Pages behavior.
6
+
7
+ The plugin builds a **full navigation tree from a configured root directory**, and allows **per-folder `_nav.yml` files to override subtrees**.
8
+
9
+ ---
10
+
11
+ ## Core Design Principles
12
+
13
+ 1. **Convention over configuration**
14
+
15
+ * Navigation should work with zero config.
16
+ * Folder structure defines navigation by default.
17
+
18
+ 2. **Local control**
19
+
20
+ * A `_nav.yml` file in a folder overrides navigation for that folder only.
21
+
22
+ 3. **Predictability**
23
+
24
+ * No merging or implicit behavior.
25
+ * Overrides are explicit and replace-only.
26
+
27
+ 4. **Full-tree navigation**
28
+
29
+ * Always render the full navigation tree from the root.
30
+ * Expand current section in UI (handled by theme).
31
+
32
+ 5. **Separation of concerns**
33
+
34
+ * Plugin generates data.
35
+ * Theme handles rendering.
36
+
37
+ ---
38
+
39
+ ## Configuration
40
+
41
+ Defined in `_config.yml`:
42
+
43
+ ```yaml
44
+ awesome_nav:
45
+ enabled: true
46
+ root: docs
47
+ nav_filename: _nav.yml
48
+ ```
49
+
50
+ ### Fields
51
+
52
+ * `enabled` (bool): enable/disable plugin
53
+ * `root` (string): root directory for navigation
54
+ * `nav_filename` (string): name of override file (default `_nav.yml`)
55
+
56
+ ---
57
+
58
+ ## Navigation Behavior
59
+
60
+ ### 1. Automatic Navigation Generation
61
+
62
+ * Navigation is generated from `site.pages` under `root`
63
+ * Folder structure determines hierarchy
64
+ * Each directory becomes a section
65
+ * Each page becomes a leaf node
66
+
67
+ Rules:
68
+
69
+ * `index.md` defines:
70
+
71
+ * section title (fallback: folder name)
72
+ * section URL
73
+ * Other pages:
74
+
75
+ * become leaf items under their directory
76
+ * Titles:
77
+
78
+ * `nav_title` → `title` → filename fallback
79
+
80
+ ---
81
+
82
+ ### 2. Full Tree Model
83
+
84
+ * A single navigation tree is built from the root
85
+ * Every page receives the same tree (`page.awesome_nav`)
86
+ * Tree structure is consistent across all pages
87
+
88
+ ---
89
+
90
+ ### 3. Override Behavior (`_nav.yml`)
91
+
92
+ * `_nav.yml` overrides navigation for its directory subtree
93
+ * Override replaces generated subtree entirely
94
+ * No merging with parent or generated structure
95
+
96
+ Resolution:
97
+
98
+ * While building final tree:
99
+
100
+ * if directory has `_nav.yml`, use it
101
+ * otherwise use generated structure
102
+
103
+ ---
104
+
105
+ ### 4. Override Scope
106
+
107
+ * Overrides apply only to their directory
108
+ * Parent and sibling sections remain unchanged
109
+ * Overrides cascade downward (children inherit overridden subtree)
110
+
111
+ ---
112
+
113
+ ### 5. No Override Case
114
+
115
+ * If no `_nav.yml` exists anywhere:
116
+
117
+ * navigation is fully auto-generated
118
+
119
+ ---
120
+
121
+ ## Data Exposed to Pages
122
+
123
+ Each page receives:
124
+
125
+ ### `page.awesome_nav`
126
+
127
+ * Full navigation tree (root-based, with overrides applied)
128
+
129
+ ### `page.awesome_nav_local`
130
+
131
+ * Local subtree for the page’s directory
132
+
133
+ ### `page.awesome_nav_dir`
134
+
135
+ * Directory that provided the active nav (override or root)
136
+
137
+ ### `page.breadcrumbs`
138
+
139
+ * Array of breadcrumb items:
140
+
141
+ ```yaml
142
+ - title: Guides
143
+ url: /docs/guides/
144
+ - title: Install
145
+ url: /docs/guides/install/
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Breadcrumb Behavior
151
+
152
+ * Derived from the final navigation tree
153
+ * Matches the path to the current page
154
+ * Uses nav titles (not filesystem names)
155
+
156
+ ---
157
+
158
+ ## File Structure Expectations
159
+
160
+ Example:
161
+
162
+ ```text
163
+ docs/
164
+ index.md
165
+ getting-started.md
166
+ guides/
167
+ install.md
168
+ config.md
169
+ ```
170
+
171
+ Optional overrides:
172
+
173
+ ```text
174
+ docs/_nav.yml
175
+ docs/guides/_nav.yml
176
+ ```
177
+
178
+ ---
179
+
180
+ ## `_nav.yml` Format
181
+
182
+ ```yaml
183
+ - title: Guides
184
+ url: /docs/guides/
185
+ children:
186
+ - title: Install
187
+ url: /docs/guides/install/
188
+ - title: Config
189
+ url: /docs/guides/config/
190
+ ```
191
+
192
+ Rules:
193
+
194
+ * Must be an array of items
195
+ * Each item:
196
+
197
+ * `title` (required)
198
+ * `url` (optional)
199
+ * `children` (optional, recursive)
200
+
201
+ ---
202
+
203
+ ## URL Handling
204
+
205
+ * URLs normalized to:
206
+
207
+ * leading slash
208
+ * trailing slash for directories
209
+ * `index.html` stripped
210
+ * Matching is done on normalized URLs
211
+
212
+ ---
213
+
214
+ ## Sorting Rules
215
+
216
+ Generated navigation:
217
+
218
+ 1. Sections before pages
219
+ 2. Alphabetical by title
220
+
221
+ Override navigation:
222
+
223
+ * Order is preserved exactly as written
224
+
225
+ ---
226
+
227
+ ## Page Inclusion Rules
228
+
229
+ * Only include pages under `root`
230
+ * Exclude `_nav.yml` files from page list
231
+ * Ignore pages outside root entirely
232
+
233
+ ---
234
+
235
+ ## Internal Implementation Notes
236
+
237
+ * Plugin type: `Jekyll::Generator`
238
+ * Runs after site inventory
239
+ * Does not modify Jekyll collections
240
+ * Works only with `site.pages`
241
+
242
+ ### Key Steps
243
+
244
+ 1. Collect pages under root
245
+ 2. Build generated tree
246
+ 3. Load `_nav.yml` overrides
247
+ 4. Apply overrides to tree (replace subtree)
248
+ 5. Assign navigation + breadcrumbs to pages
249
+
250
+ ---
251
+
252
+ ## Non-Goals
253
+
254
+ * No support for:
255
+
256
+ * merging nav structures
257
+ * multiple nav roots
258
+ * dynamic runtime nav generation
259
+ * collection integration
260
+ * No UI rendering logic in plugin
261
+
262
+ ---
263
+
264
+ ## Future Extensions (Optional)
265
+
266
+ * `nav_title` override in front matter
267
+ * Hidden pages (`nav_exclude`)
268
+ * Ordering via front matter
269
+ * Collapsible state hints
270
+ * Multiple roots
271
+
272
+ ---
273
+
274
+ ## Summary
275
+
276
+ This plugin provides:
277
+
278
+ * Automatic navigation from folder structure
279
+ * Full-tree sidebar navigation
280
+ * Local override via `_nav.yml`
281
+ * Breadcrumb generation
282
+
283
+ Design is intentionally:
284
+
285
+ * simple
286
+ * predictable
287
+ * aligned with MkDocs-style workflows
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at allison@allisonthackston.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Allison Thackston
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.