jekyll-vitepress-theme 0.9.1 → 0.10.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa9391084d58e782e53928675a222528a6e2bb36c206182f2e461d0bd87e7056
4
- data.tar.gz: 535dd94bd744cbebe9767d9a6513a4ceb6164c391402f9108125ee0920554006
3
+ metadata.gz: c72127aab4edfc3683419977efbdde3e174b7d70970be4253fbccdcb6c32f8ea
4
+ data.tar.gz: 51bf7450c3ab178de305c5d81a1dccefa25fdfc6555a7d2fa2b7a6ecc5ef543a
5
5
  SHA512:
6
- metadata.gz: ca5243e5c90205f0e37363c90bab9e02bc7e3235a2d7b873c843e00c40c5a78af014b6f80df88482935642c682cf639963febfb9df3a840ec2e53515b46a1802
7
- data.tar.gz: 870b669c9cbe0096eb82fba8b878eba38de4c59f5e7a9fc00ee1f5a389304c33fdb34ab69047abc322f65eeaf9498a519e87a3d01b0f1a10e1bd7de8d2f29433
6
+ metadata.gz: cf130d94547b75b6ed9cb2b9e42518dbb8fd3294ab5b90f6c8f7901fc3b6b84a4655adb49b04f3051cf09fafb3a338f701d8a9bfddf445ead55b4cf894a3272f
7
+ data.tar.gz: f12ebaec4d69c77e9d6b2d5a6ddfd24f43fd6e86868d7f611d977fac62bce5d159db268f71e2032eeee2d66b85be8bb409635797e903b9cc3ceed1503cf3f486
data/README.md CHANGED
@@ -7,10 +7,11 @@ A reusable Jekyll theme gem that reproduces the VitePress default docs experienc
7
7
  - VitePress-style layout structure (top nav, sidebar, outline, doc footer)
8
8
  - Appearance toggle with `auto -> dark -> light`
9
9
  - Local search modal (`/`, `Ctrl/Cmd+K`, `Cmd+K`)
10
+ - Optional GitHub star button with live count (`jekyll_vitepress.github_star`)
10
11
  - Code block copy button, language labels, file-title bars and icons
11
- - Rouge-native syntax theme config (`vp_theme.rouge_theme.light/dark`)
12
+ - Rouge-native syntax theme config (`jekyll_vitepress.syntax.light_theme/dark_theme`)
12
13
  - Last-updated hook via plugin
13
- - Slot includes for lightweight theme extension (`_includes/vp_slots/head.html`, `doc_footer.html`, `layout_bottom.html`)
14
+ - Jekyll-native extension hooks (`_includes/jekyll_vitepress/head_end.html`, `doc_footer_end.html`, `layout_end.html`)
14
15
 
15
16
  ## Installation
16
17
 
@@ -28,17 +29,30 @@ plugins:
28
29
  - jekyll-vitepress-theme
29
30
  ```
30
31
 
31
- 3. Add `vp_theme` configuration:
32
+ 3. Add theme behavior config in `_config.yml`:
32
33
 
33
34
  ```yaml
34
- vp_theme:
35
- nav:
36
- - text: Guide
37
- link: /what-is-jekyll-vitepress-theme/
38
- collections: [getting_started, core_features, advanced]
39
- sidebar_collections:
40
- - id: getting_started
41
- text: Introduction
35
+ jekyll_vitepress:
36
+ branding:
37
+ site_title: My Docs
38
+ syntax:
39
+ light_theme: github
40
+ dark_theme: github.dark
41
+ ```
42
+
43
+ 4. Add navigation and sidebar data files:
44
+
45
+ ```yaml
46
+ # _data/navigation.yml
47
+ - title: Guide
48
+ url: /getting-started/
49
+ collections: [introduction, core_features, advanced]
50
+ ```
51
+
52
+ ```yaml
53
+ # _data/sidebar.yml
54
+ - title: Getting Started
55
+ collection: introduction
42
56
  ```
43
57
 
44
58
  ## Local development (this repo)
@@ -80,6 +94,7 @@ See docs pages:
80
94
  - [Getting Started](/getting-started/)
81
95
  - [Configuration Reference](/configuration-reference/)
82
96
  - [Frontmatter Reference](/frontmatter-reference/)
97
+ - [VitePress Parity and Extensions](/vitepress-parity-and-extensions/)
83
98
 
84
99
  ## Release a gem
85
100
 
@@ -1,34 +1,45 @@
1
+ {% assign theme = site.jekyll_vitepress %}
2
+ {% assign page_theme = page.jekyll_vitepress %}
3
+
4
+ {% assign edit_link_config = theme.edit_link %}
1
5
  {% assign edit_link_enabled = true %}
2
- {% if site.vp_theme.edit_link == false or page.edit_link == false %}
6
+ {% if edit_link_config and edit_link_config.enabled == false %}
7
+ {% assign edit_link_enabled = false %}
8
+ {% endif %}
9
+ {% if page_theme.edit_link == false %}
3
10
  {% assign edit_link_enabled = false %}
4
11
  {% endif %}
5
12
 
6
13
  {% assign edit_link = nil %}
7
- {% if edit_link_enabled and site.vp_theme.edit_link and site.vp_theme.edit_link.pattern and page.path %}
8
- {% assign edit_link = site.vp_theme.edit_link.pattern | replace: ':path', page.path %}
14
+ {% if edit_link_enabled and edit_link_config and edit_link_config.pattern and page.path %}
15
+ {% assign edit_link = edit_link_config.pattern | replace: ':path', page.path %}
9
16
  {% endif %}
10
17
 
11
18
  {% assign edit_link_text = 'Edit this page on GitHub' %}
12
- {% if site.vp_theme.edit_link and site.vp_theme.edit_link.text %}
13
- {% assign edit_link_text = site.vp_theme.edit_link.text %}
19
+ {% if edit_link_config and edit_link_config.text %}
20
+ {% assign edit_link_text = edit_link_config.text %}
14
21
  {% endif %}
15
22
 
23
+ {% assign last_updated_config = theme.last_updated %}
16
24
  {% assign last_updated_enabled = true %}
17
- {% if site.vp_theme.last_updated == false or page.last_updated == false %}
25
+ {% if last_updated_config and last_updated_config.enabled == false %}
26
+ {% assign last_updated_enabled = false %}
27
+ {% endif %}
28
+ {% if page_theme.last_updated == false %}
18
29
  {% assign last_updated_enabled = false %}
19
30
  {% endif %}
20
31
 
21
32
  {% assign last_updated_text = 'Last updated' %}
22
- {% if site.vp_theme.last_updated and site.vp_theme.last_updated.text %}
23
- {% assign last_updated_text = site.vp_theme.last_updated.text %}
33
+ {% if last_updated_config and last_updated_config.text %}
34
+ {% assign last_updated_text = last_updated_config.text %}
24
35
  {% endif %}
25
36
 
26
37
  {% assign last_updated_format = '%-d %b %Y, %H:%M' %}
27
- {% if site.vp_theme.last_updated and site.vp_theme.last_updated.format %}
28
- {% assign last_updated_format = site.vp_theme.last_updated.format %}
38
+ {% if last_updated_config and last_updated_config.format %}
39
+ {% assign last_updated_format = last_updated_config.format %}
29
40
  {% endif %}
30
41
 
31
- {% assign last_updated_at = page.last_updated_at | default: page.last_updated | default: nil %}
42
+ {% assign last_updated_at = page_theme.last_updated_at | default: nil %}
32
43
  {% assign show_last_updated = false %}
33
44
  {% if last_updated_enabled and last_updated_at %}
34
45
  {% assign show_last_updated = true %}
@@ -52,8 +63,12 @@
52
63
  {% endfor %}
53
64
  {% endif %}
54
65
 
66
+ {% assign doc_footer_config = theme.doc_footer %}
55
67
  {% assign doc_footer_enabled = true %}
56
- {% if site.vp_theme.doc_footer == false or page.doc_footer == false %}
68
+ {% if doc_footer_config and doc_footer_config.enabled == false %}
69
+ {% assign doc_footer_enabled = false %}
70
+ {% endif %}
71
+ {% if page_theme.doc_footer == false %}
57
72
  {% assign doc_footer_enabled = false %}
58
73
  {% endif %}
59
74
 
@@ -62,39 +77,39 @@
62
77
  {% assign prev_desc = 'Previous page' %}
63
78
  {% assign next_desc = 'Next page' %}
64
79
 
65
- {% if site.vp_theme.doc_footer and site.vp_theme.doc_footer != false %}
66
- {% if site.vp_theme.doc_footer.prev == false %}
80
+ {% if doc_footer_config %}
81
+ {% if doc_footer_config.previous_label == false %}
67
82
  {% assign prev_enabled = false %}
68
- {% elsif site.vp_theme.doc_footer.prev %}
69
- {% assign prev_desc = site.vp_theme.doc_footer.prev %}
83
+ {% elsif doc_footer_config.previous_label %}
84
+ {% assign prev_desc = doc_footer_config.previous_label %}
70
85
  {% endif %}
71
86
 
72
- {% if site.vp_theme.doc_footer.next == false %}
87
+ {% if doc_footer_config.next_label == false %}
73
88
  {% assign next_enabled = false %}
74
- {% elsif site.vp_theme.doc_footer.next %}
75
- {% assign next_desc = site.vp_theme.doc_footer.next %}
89
+ {% elsif doc_footer_config.next_label %}
90
+ {% assign next_desc = doc_footer_config.next_label %}
76
91
  {% endif %}
77
92
  {% endif %}
78
93
 
79
- {% if page.doc_footer and page.doc_footer != false %}
80
- {% if page.doc_footer.prev == false %}
94
+ {% if page_theme.doc_footer and page_theme.doc_footer != false %}
95
+ {% if page_theme.doc_footer.prev == false %}
81
96
  {% assign prev_enabled = false %}
82
- {% elsif page.doc_footer.prev %}
83
- {% assign prev_desc = page.doc_footer.prev %}
97
+ {% elsif page_theme.doc_footer.prev %}
98
+ {% assign prev_desc = page_theme.doc_footer.prev %}
84
99
  {% endif %}
85
100
 
86
- {% if page.doc_footer.next == false %}
101
+ {% if page_theme.doc_footer.next == false %}
87
102
  {% assign next_enabled = false %}
88
- {% elsif page.doc_footer.next %}
89
- {% assign next_desc = page.doc_footer.next %}
103
+ {% elsif page_theme.doc_footer.next %}
104
+ {% assign next_desc = page_theme.doc_footer.next %}
90
105
  {% endif %}
91
106
  {% endif %}
92
107
 
93
- {% if page.prev == false %}
108
+ {% if page_theme.prev == false %}
94
109
  {% assign prev_enabled = false %}
95
110
  {% endif %}
96
111
 
97
- {% if page.next == false %}
112
+ {% if page_theme.next == false %}
98
113
  {% assign next_enabled = false %}
99
114
  {% endif %}
100
115
 
@@ -104,9 +119,9 @@
104
119
  {% assign next_title = nil %}
105
120
 
106
121
  {% if prev_enabled %}
107
- {% if page.prev and page.prev != false and page.prev.link %}
108
- {% assign prev_url = page.prev.link %}
109
- {% assign prev_title = page.prev.text | default: page.prev.link %}
122
+ {% if page_theme.prev and page_theme.prev != false and page_theme.prev.link %}
123
+ {% assign prev_url = page_theme.prev.link %}
124
+ {% assign prev_title = page_theme.prev.text | default: page_theme.prev.link %}
110
125
  {% elsif prev_doc %}
111
126
  {% assign prev_url = prev_doc.url | relative_url %}
112
127
  {% assign prev_title = prev_doc.title %}
@@ -114,9 +129,9 @@
114
129
  {% endif %}
115
130
 
116
131
  {% if next_enabled %}
117
- {% if page.next and page.next != false and page.next.link %}
118
- {% assign next_url = page.next.link %}
119
- {% assign next_title = page.next.text | default: page.next.link %}
132
+ {% if page_theme.next and page_theme.next != false and page_theme.next.link %}
133
+ {% assign next_url = page_theme.next.link %}
134
+ {% assign next_title = page_theme.next.text | default: page_theme.next.link %}
120
135
  {% elsif next_doc %}
121
136
  {% assign next_url = next_doc.url | relative_url %}
122
137
  {% assign next_title = next_doc.title %}
@@ -132,8 +147,17 @@
132
147
  {% assign show_next_link = true %}
133
148
  {% endif %}
134
149
 
150
+ {% capture doc_footer_end_markup %}
151
+ {% include jekyll_vitepress/doc_footer_end.html %}
152
+ {% endcapture %}
153
+ {% assign doc_footer_end_markup = doc_footer_end_markup | strip %}
154
+ {% assign show_doc_footer_end = false %}
155
+ {% if doc_footer_end_markup != '' %}
156
+ {% assign show_doc_footer_end = true %}
157
+ {% endif %}
158
+
135
159
  {% assign show_footer = false %}
136
- {% if edit_link or show_last_updated or show_prev_link or show_next_link %}
160
+ {% if edit_link or show_last_updated or show_prev_link or show_next_link or show_doc_footer_end %}
137
161
  {% assign show_footer = true %}
138
162
  {% endif %}
139
163
 
@@ -180,5 +204,9 @@
180
204
  </div>
181
205
  </nav>
182
206
  {% endif %}
207
+
208
+ {% if show_doc_footer_end %}
209
+ {{ doc_footer_end_markup }}
210
+ {% endif %}
183
211
  </footer>
184
212
  {% endif %}
data/_includes/head.html CHANGED
@@ -4,12 +4,18 @@
4
4
  {% assign page_title = page.title | default: site.title %}
5
5
  <title>{% if page_title and page_title != site.title %}{{ page_title }} | {{ site.title }}{% else %}{{ site.title }}{% endif %}</title>
6
6
  <meta name="description" content="{{ page.description | default: site.description | escape }}">
7
- <link rel="icon" href="{{ site.vp_theme.logo | default: site.vp_theme.logo_light | default: '/vitepress-logo-mini.svg' | relative_url }}">
8
- {% assign vp_google_fonts_url = site.vp_theme.google_fonts_url | default: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap' %}
9
- {% if vp_google_fonts_url %}
7
+
8
+ {% assign theme = site.jekyll_vitepress %}
9
+ {% assign branding = theme.branding %}
10
+ {% assign logo = branding.logo %}
11
+ <link rel="icon" href="{{ logo.default | default: logo.light | default: '/vitepress-logo-mini.svg' | relative_url }}">
12
+
13
+ {% assign typography = theme.typography %}
14
+ {% assign google_fonts_url = typography.google_fonts_url | default: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap' %}
15
+ {% if google_fonts_url and google_fonts_url != false and google_fonts_url != '' %}
10
16
  <link rel="preconnect" href="https://fonts.googleapis.com">
11
17
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
12
- <link rel="stylesheet" href="{{ vp_google_fonts_url }}">
18
+ <link rel="stylesheet" href="{{ google_fonts_url }}">
13
19
  {% endif %}
14
20
 
15
21
  <script>
@@ -41,27 +47,27 @@
41
47
  <link rel="stylesheet" href="{{ '/assets/css/vp-icons.css' | relative_url }}">
42
48
  <link rel="stylesheet" href="{{ '/assets/css/vitepress-overrides.css' | relative_url }}">
43
49
 
44
- {% assign vp_font_family_base = site.vp_theme.font_family_base %}
45
- {% assign vp_font_family_mono = site.vp_theme.font_family_mono %}
46
- {% assign vp_css_vars_light = site.vp_theme.css_vars.light %}
47
- {% assign vp_css_vars_dark = site.vp_theme.css_vars.dark %}
50
+ {% assign body_font_family = typography.body_font_family %}
51
+ {% assign code_font_family = typography.code_font_family %}
52
+ {% assign token_vars_light = theme.tokens.light %}
53
+ {% assign token_vars_dark = theme.tokens.dark %}
48
54
  {% assign has_theme_var_overrides = false %}
49
- {% if vp_font_family_base or vp_font_family_mono %}
55
+ {% if body_font_family or code_font_family %}
50
56
  {% assign has_theme_var_overrides = true %}
51
57
  {% endif %}
52
- {% if vp_css_vars_light and vp_css_vars_light.size > 0 %}
58
+ {% if token_vars_light and token_vars_light.size > 0 %}
53
59
  {% assign has_theme_var_overrides = true %}
54
60
  {% endif %}
55
- {% if vp_css_vars_dark and vp_css_vars_dark.size > 0 %}
61
+ {% if token_vars_dark and token_vars_dark.size > 0 %}
56
62
  {% assign has_theme_var_overrides = true %}
57
63
  {% endif %}
58
64
  {% if has_theme_var_overrides %}
59
65
  <style id="vp-theme-vars">
60
66
  :root {
61
- {% if vp_font_family_base %}--vp-font-family-base: {{ vp_font_family_base }};{% endif %}
62
- {% if vp_font_family_mono %}--vp-font-family-mono: {{ vp_font_family_mono }};{% endif %}
63
- {% if vp_css_vars_light %}
64
- {% for pair in vp_css_vars_light %}
67
+ {% if body_font_family %}--vp-font-family-base: {{ body_font_family }};{% endif %}
68
+ {% if code_font_family %}--vp-font-family-mono: {{ code_font_family }};{% endif %}
69
+ {% if token_vars_light %}
70
+ {% for pair in token_vars_light %}
65
71
  {% assign css_var_name = pair[0] | strip %}
66
72
  {% if css_var_name contains '--' %}
67
73
  {{ css_var_name }}: {{ pair[1] }};
@@ -71,9 +77,9 @@
71
77
  {% endfor %}
72
78
  {% endif %}
73
79
  }
74
- {% if vp_css_vars_dark and vp_css_vars_dark.size > 0 %}
80
+ {% if token_vars_dark and token_vars_dark.size > 0 %}
75
81
  .dark {
76
- {% for pair in vp_css_vars_dark %}
82
+ {% for pair in token_vars_dark %}
77
83
  {% assign css_var_name = pair[0] | strip %}
78
84
  {% if css_var_name contains '--' %}
79
85
  {{ css_var_name }}: {{ pair[1] }};
@@ -86,13 +92,13 @@
86
92
  </style>
87
93
  {% endif %}
88
94
 
89
- {% assign vp_rouge_css = site.vp_theme._generated_rouge_css %}
90
- {% if vp_rouge_css and vp_rouge_css != '' %}
95
+ {% assign rouge_css = theme._generated_rouge_css %}
96
+ {% if rouge_css and rouge_css != '' %}
91
97
  <style id="vp-rouge-theme">
92
- {{ vp_rouge_css }}
98
+ {{ rouge_css }}
93
99
  </style>
94
100
  {% endif %}
95
101
 
96
- {% include vp_slots/head.html %}
102
+ {% include jekyll_vitepress/head_end.html %}
97
103
  <script src="{{ '/assets/js/vitepress-theme.js' | relative_url }}" defer></script>
98
104
  </head>
data/_includes/home.html CHANGED
@@ -254,9 +254,9 @@
254
254
  {% if feature.details %}
255
255
  <p class="details">{{ feature.details }}</p>
256
256
  {% endif %}
257
- {% if feature.linkText %}
257
+ {% if feature.link_text %}
258
258
  <div class="link-text">
259
- <p class="link-text-value">{{ feature.linkText }} <span class="vpi-arrow-right link-text-icon"></span></p>
259
+ <p class="link-text-value">{{ feature.link_text }} <span class="vpi-arrow-right link-text-icon"></span></p>
260
260
  </div>
261
261
  {% endif %}
262
262
  </article>
@@ -302,7 +302,7 @@
302
302
  {% endif %}
303
303
 
304
304
  {% if home_body != '' %}
305
- {% if page.markdownStyles == false %}
305
+ {% if page.markdown_styles == false %}
306
306
  {{ include.content }}
307
307
  {% else %}
308
308
  <div class="VPHomeContent">
@@ -0,0 +1 @@
1
+ <!-- Optional head hook. Override in your site at _includes/jekyll_vitepress/head_end.html. -->
@@ -1,18 +1,19 @@
1
+ {% assign labels = site.jekyll_vitepress.labels %}
1
2
  <div class="VPLocalNav has-sidebar" id="vp-local-nav">
2
3
  <div class="container">
3
4
  <button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" id="vp-local-menu-button">
4
5
  <span class="vpi-align-left menu-icon"></span>
5
- <span class="menu-text">{{ site.vp_theme.sidebar_menu_label | default: 'Menu' }}</span>
6
+ <span class="menu-text">{{ labels.sidebar_menu | default: 'Menu' }}</span>
6
7
  </button>
7
8
 
8
9
  <div class="VPLocalNavOutlineDropdown" id="vp-local-outline-dropdown">
9
10
  <button type="button" id="vp-local-outline-button">
10
- <span class="menu-text">{{ site.vp_theme.outline_title | default: 'On this page' }}</span>
11
+ <span class="menu-text">{{ labels.outline | default: 'On this page' }}</span>
11
12
  <span class="vpi-chevron-right icon"></span>
12
13
  </button>
13
14
  <div class="items" hidden>
14
15
  <div class="header">
15
- <a class="top-link" href="#top" id="vp-local-top-link">{{ site.vp_theme.return_to_top_label | default: 'Return to top' }}</a>
16
+ <a class="top-link" href="#top" id="vp-local-top-link">{{ labels.return_to_top | default: 'Return to top' }}</a>
16
17
  </div>
17
18
  <div class="outline">
18
19
  <ul class="VPDocOutlineItem"></ul>