jekyll-theme-gitbook 0.0.1 → 0.0.3

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: 0a6efdeacd85eb499cce5307098b92cf20e7eef3458ff75878aed59b8b9579dd
4
- data.tar.gz: 83c13ca9dc58ccab2291f74e02cbdbbbb4201685b64b9d61445d47f4a5af3edf
3
+ metadata.gz: 4e55032d1d46d8f8a1b6c58ab2a53e60d2aad1dd297f16c1bae5b83be0d309e8
4
+ data.tar.gz: 4d51893394120d5efeaf0b2284fa48a238fcf35c123fc862274e13edde266afa
5
5
  SHA512:
6
- metadata.gz: f993ea2fd89503b9251f44fd0cbd0c2d1e7446cce2b48c3a7c6af8b697ca4a16630bf286b2ea11a50044226733b934980eab1bc3716d19b8153e7da418ce2f46
7
- data.tar.gz: a650914b667f87d35796cea2c242e1ccc56216f396129a5946ccf3566cf15d04b0c59b4208e67980c65d413a34a10a4c81ab1ac4b8c8a7b78275aa45a9ac9d7e
6
+ metadata.gz: a4173c81205c974d250d58ac5bfa3cc7bce37f1ceb85296c7fae49ed41f2d19270a6f4047e94c1e0ea328b85ffeba3dfad82c38ffeed9eb2b6be26a29aad0fb0
7
+ data.tar.gz: e882279dad7d78c92f928c521c85afe102b6077b143e6a734dcafd3fafc588fb6bd55d30804cdffa683ae84866d1faba4308a41361b5ed74cdbe77ee4d64445d
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Adam Rehn
3
+ Copyright (c) 2020 - 2022 Adam Rehn
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -4,6 +4,8 @@ This is a documentation theme for [Jekyll](https://jekyllrb.com/) that takes its
4
4
 
5
5
  This theme is designed to be highly configurable, whilst providing sensible defaults for most options in order to make it as easy as possible to get up and running quickly. See the [Configuration](#configuration) section for details of the available settings.
6
6
 
7
+ **You can view a [live demo of this theme here](https://adamrehn.github.io/jekyll-theme-gitbook-demo) and view the [source code for the demo site here](https://github.com/adamrehn/jekyll-theme-gitbook-demo).**
8
+
7
9
 
8
10
  ## Contents
9
11
 
@@ -32,7 +34,7 @@ This theme is designed to be highly configurable, whilst providing sensible defa
32
34
  If you are hosting your site on GitHub Pages then add the following line to your site's `_config.yml` file (as per [the documentation](https://docs.github.com/en/github/working-with-github-pages/adding-a-theme-to-your-github-pages-site-using-jekyll)):
33
35
 
34
36
  ```yaml
35
- remote_theme: "adamrehn/jekyll-theme-gitbook"
37
+ remote_theme: "adamrehn/jekyll-theme-gitbook@v0.0.3"
36
38
  ```
37
39
 
38
40
  ### Other hosts (e.g. GitLab Pages)
@@ -186,8 +188,6 @@ defaults:
186
188
  # An icon is optional and will be displayed next to the chapter name if specified
187
189
  icon: "fas fa-school"
188
190
 
189
- # A blurb is optional and will be displayed if you generate a list of chapters with the `chapter-list.html` include
190
- blurb: "This category covers basic topics."
191
191
  -
192
192
  scope:
193
193
  path: "_collections/_categories/intermediate"
@@ -195,7 +195,6 @@ defaults:
195
195
  chapter: "Intermediate"
196
196
  chapnum: 2
197
197
  icon: "fas fa-university"
198
- blurb: "This category covers intermediate topics."
199
198
  -
200
199
  scope:
201
200
  path: "_collections/_categories/advanced"
@@ -203,7 +202,6 @@ defaults:
203
202
  chapter: "Advanced"
204
203
  chapnum: 3
205
204
  icon: "fas fa-graduation-cap"
206
- blurb: "This category covers advanced topics."
207
205
  ```
208
206
 
209
207
  ### Site structure
@@ -235,21 +233,25 @@ Page content goes here.
235
233
 
236
234
  #### Content structure: chapters
237
235
 
238
- Each chapter should also include an `index.html` file, which should specify either the `chapter-index` or `chapter-redirect` layout and nothing else:
236
+ Each chapter should also include an `index.html` file, which should specify either the `chapter-index` or `chapter-redirect` layout and can optionally include a chapter description:
239
237
 
240
238
  ```yaml
241
239
  ---
242
240
  layout: chapter-redirect
243
241
  ---
242
+
243
+ Optional description of this chapter goes here.
244
244
  ```
245
245
 
246
246
  The layout you choose will determine the site's behaviour when navigating to the index for a chapter (which is resolved automatically when referencing a subdirectory's path without a trailing page path.) Choose the `chapter-index` layout if you would like the web browser to display a list of links to the pages in the chapter, or the `chapter-redirect` layout if you would like the web browser to automatically redirect to the first page in the chapter.
247
247
 
248
- If you use the `chapter-index` layout for a chapter and the global setting `theme-settings.indices` is set to `true` then a navigation link will be generated for the chapter index.
248
+ If you choose to provide a chapter description then this will be displayed on the chapter's index page when using the `chapter-index` layout, and will also be displayed under the chapter's name if you generate a list of chapters with the `chapter-list.html` include (which is designed to be used on the front page of a site.)
249
+
250
+ If you use the `chapter-index` layout for a chapter and the global setting `theme-settings.indices` is set to `true` then a link will be generated for the chapter index in the site's navigation sidebar.
249
251
 
250
252
  #### Content structure: site root
251
253
 
252
- You can specify custom content for the site's front page by providing an `index.html` or `index.md` file in the root of your site's filesystem directory. The `chapter-list.html` include that ships with the theme is designed for use from the site root, and generates a list of chapters for you (with per-chapter `blurb` values included if they were specified.)
254
+ You can specify custom content for the site's front page by providing an `index.html` or `index.md` file in the root of your site's filesystem directory. The `chapter-list.html` include that ships with the theme is designed for use from the site root, and generates a list of chapters for you (with per-chapter descriptions included if they were specified.)
253
255
 
254
256
  If you do not want to have a custom front page then you can use the `root-redirect` layout to instruct web browsers to automatically redirect to the index of the first chapter (which may in turn redirect to the first page of that chapter if you specified that behaviour, as discussed in the previous section):
255
257
 
@@ -298,7 +300,7 @@ The theme supports the following advanced configuration options:
298
300
 
299
301
  ## Legal
300
302
 
301
- Copyright © 2020, Adam Rehn. Licensed under the MIT License, see the file [LICENSE](https://github.com/adamrehn/jekyll-theme-gitbook/blob/master/LICENSE) for details.
303
+ Copyright © 2020 - 2022, Adam Rehn. Licensed under the MIT License, see the file [LICENSE](https://github.com/adamrehn/jekyll-theme-gitbook/blob/master/LICENSE) for details.
302
304
 
303
305
  The following third-party libraries are bundled in the theme's source tree and are covered by their respective licenses:
304
306
 
@@ -1,5 +1,7 @@
1
1
  {{
2
2
  include.content |
3
3
  replace: '<table', '<div class="table-wrapper"><table' |
4
- replace: '</table>', '</table></div>'
4
+ replace: '</table>', '</table></div>' |
5
+ replace: '<pre', '<div class="pre-wrapper"><pre' |
6
+ replace: '</pre>', '</pre></div>'
5
7
  }}
@@ -0,0 +1,113 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ {% include internal/meta.html %}
5
+
6
+ <title>{{ site.title | escape }}</title>
7
+
8
+ {% if site.theme-settings.fontawesome.kit %}
9
+ <script src="{{ site.theme-settings.fontawesome.kit | uri_escape }}" crossorigin="anonymous"></script>
10
+ {% elsif site.theme-settings.fontawesome.local != true %}
11
+ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.1/css/all.css" integrity="sha384-xxzQGERXS00kBmZW/6qxqJPyxW3UR0BPsL4c8ILaIWXva5kFi7TxkIIaMiKtqV1Q" crossorigin="anonymous">
12
+ {% endif %}
13
+
14
+ {% include hooks/head-posthook.html %}
15
+ </head>
16
+
17
+ <body class="print">
18
+
19
+ <main>
20
+
21
+ {% comment %}
22
+
23
+ Loop through our chapters and their pages, building one large markdown string suitable for TOC generation.
24
+ We want this to all be a single string to ensure unique IDs are still generated even if there are headings with duplicate text.
25
+
26
+ Note that we use HTML comments to inject our <section> and <article> tags, since the markdown processor will preserve the comments verbatim
27
+ and we can then strip them away to leave our HTML tags intact in the final output without being erroneously wrapped in <p> tags.
28
+
29
+ {% endcomment %}
30
+
31
+ {% assign markdown = "" %}
32
+ {% assign indices = site.documents | where: "collection", site.theme-settings.collection | where_exp: "page", "page.chapnum != null" | where_exp: "page", "page.pagenum == null" | sort: "chapnum" %}
33
+ {% if page.subsite %}
34
+ {% assign indices = indices | where: "subsite", page.subsite %}
35
+ {% endif %}
36
+ {% for index in indices %}
37
+
38
+ {% assign pages = site.documents | where: "collection", site.theme-settings.collection | where: "chapnum", index.chapnum | where_exp: "page", "page.pagenum != null" | sort: "pagenum" %}
39
+ {% if page.subsite %}
40
+ {% assign pages = pages | where: "subsite", page.subsite %}
41
+ {% endif %}
42
+
43
+ {% capture content %}
44
+
45
+ <!--[[<section class="chapter">]]-->
46
+
47
+ # Chapter {{ index.chapnum }}: {{ index.chapter | escape }}
48
+
49
+ {% assign description = index.content | strip %}{% if description.size > 0 %}{{ description }}{% endif %}
50
+
51
+ <!--[[</section>]]-->
52
+
53
+ {% for page in pages %}
54
+
55
+ <!--[[<article class="page">]]-->
56
+
57
+ # {{ page.title | escape }}
58
+
59
+ {{ page.content }}
60
+
61
+ <!--[[</article>]]-->
62
+
63
+ {% endfor %}
64
+
65
+ {% endcapture %}
66
+
67
+ {% assign markdown = markdown | append: content %}
68
+
69
+ {% endfor %}
70
+
71
+ {% comment %}
72
+
73
+ Render our generated markdown string and strip away the comment wrappers from our HTML tags.
74
+
75
+ {% endcomment %}
76
+ {% assign rendered = markdown | markdownify | replace: "<!--[[", "" | replace: "]]-->", "" %}
77
+
78
+ {% comment %}
79
+
80
+ Output our book cover.
81
+
82
+ {% endcomment %}
83
+ <section class="cover">
84
+ <h1>{{ site.title | escape }}</h1>
85
+ </section>
86
+
87
+ {% comment %}
88
+
89
+ Generate our Table of Contents (TOC) using the rendered markdown output and add a CSS class to chapter links.
90
+
91
+ {% endcomment %}
92
+ <section class="toc">
93
+ <h1>Contents</h1>
94
+ {% capture toc %}{% include thirdparty/toc.html html=rendered sanitize=true %}{% endcapture %}
95
+ {{ toc | replace: '<li><a href="#chapter-', '<li class="chapter-link"><a href="#chapter-' }}
96
+ </section>
97
+
98
+ {% comment %}
99
+
100
+ Perform postprocessing on the rendered markdown output and print the result.
101
+
102
+ {% endcomment %}
103
+ {% include internal/postprocessing.html content=rendered %}
104
+
105
+ </main>
106
+
107
+ <script src="{{ "/" | relative_url }}assets/js/thirdparty/jquery-3.4.1.min.js"></script>
108
+ <script src="{{ "/" | relative_url }}assets/js/thirdparty/popper.min.js"></script>
109
+ <script src="{{ "/" | relative_url }}assets/js/thirdparty/bootstrap.min.js"></script>
110
+ <script src="{{ "/" | relative_url }}assets/js/jekyll-theme-gitbook.js"></script>
111
+ {% include hooks/body-posthook.html %}
112
+ </body>
113
+ </html>
data/_sass/_content.scss CHANGED
@@ -236,12 +236,14 @@ article p + ul {
236
236
  margin: 2rem 0;
237
237
  }
238
238
 
239
- article .table-wrapper
240
- {
241
- margin: 2rem 0;
239
+ article .pre-wrapper, article .table-wrapper {
242
240
  overflow-x: auto;
243
241
  }
244
242
 
243
+ article .table-wrapper {
244
+ margin: 2rem 0;
245
+ }
246
+
245
247
  article table
246
248
  {
247
249
  border-color: $default-border-colour;
@@ -314,6 +316,15 @@ article pre
314
316
  word-wrap: break-word;
315
317
  }
316
318
 
319
+ article pre code, article li pre code
320
+ {
321
+ background-color: transparent;
322
+ padding: 0;
323
+ border-radius: 0;
324
+ display: inline;
325
+ margin: 0;
326
+ }
327
+
317
328
  article pre, article pre code {
318
329
  font-size: 0.95rem;
319
330
  }
data/_sass/_layout.scss CHANGED
@@ -4,77 +4,81 @@
4
4
  box-sizing: border-box;
5
5
  }
6
6
 
7
- html, body
8
- {
9
- scroll-behavior: smooth;
10
- min-height: 100%;
11
- }
12
-
13
- header
14
- {
15
- display: flex;
16
- flex-direction: row;
17
- justify-content: space-between;
18
- align-items: center;
7
+ @media not print {
19
8
 
20
- padding: $header-padding 0;
21
- height: $header-height;
22
- position: fixed;
23
- z-index: 999;
24
- width: 100%;
25
- top: 0;
26
- }
27
-
28
- .wrapper
29
- {
30
- display: flex;
31
- flex-direction: row;
32
- }
33
-
34
- nav, .contents {
35
- flex: 0 0 auto;
36
- }
37
-
38
- nav .inner
39
- {
40
- padding-top: $header-height / 2;
41
- padding-left: $sidebar-padding / 2;
42
- height: calc(100vh - #{$header-height});
9
+ html, body
10
+ {
11
+ scroll-behavior: smooth;
12
+ min-height: 100%;
13
+ }
14
+
15
+ header
16
+ {
17
+ display: flex;
18
+ flex-direction: row;
19
+ justify-content: space-between;
20
+ align-items: center;
21
+
22
+ padding: $header-padding 0;
23
+ height: $header-height;
24
+ position: fixed;
25
+ z-index: 999;
26
+ width: 100%;
27
+ top: 0;
28
+ }
29
+
30
+ .wrapper
31
+ {
32
+ display: flex;
33
+ flex-direction: row;
34
+ }
35
+
36
+ nav, .contents {
37
+ flex: 0 0 auto;
38
+ }
39
+
40
+ nav .inner
41
+ {
42
+ padding-top: $header-height / 2;
43
+ padding-left: $sidebar-padding / 2;
44
+ height: calc(100vh - #{$header-height});
45
+
46
+ overflow: hidden auto;
47
+ position: sticky;
48
+ top: $header-height;
49
+ }
50
+
51
+ main
52
+ {
53
+ flex: 1;
54
+ display: flex;
55
+ flex-direction: row;
56
+ margin-top: $header-height;
57
+ padding: $header-height/2 0;
58
+ }
59
+
60
+ .contents {
61
+ order: 2;
62
+ }
63
+
64
+ .contents .inner
65
+ {
66
+ position: sticky;
67
+ top: $header-height * 1.5;
68
+ }
69
+
70
+ .contents ul li a {
71
+ display: block;
72
+ }
73
+
74
+ .contents-inline {
75
+ display: none;
76
+ }
77
+
78
+ article
79
+ {
80
+ order: 1;
81
+ flex: 1;
82
+ }
43
83
 
44
- overflow: hidden auto;
45
- position: sticky;
46
- top: $header-height;
47
- }
48
-
49
- main
50
- {
51
- flex: 1;
52
- display: flex;
53
- flex-direction: row;
54
- margin-top: $header-height;
55
- padding: $header-height/2 0;
56
- }
57
-
58
- .contents {
59
- order: 2;
60
- }
61
-
62
- .contents .inner
63
- {
64
- position: sticky;
65
- top: $header-height * 1.5;
66
- }
67
-
68
- .contents ul li a {
69
- display: block;
70
- }
71
-
72
- .contents-inline {
73
- display: none;
74
- }
75
-
76
- article
77
- {
78
- order: 1;
79
- flex: 1;
80
84
  }
data/_sass/_print.scss ADDED
@@ -0,0 +1,52 @@
1
+ @charset "UTF-8";
2
+
3
+ .print main, .print main article
4
+ {
5
+ display: block;
6
+ padding: 0;
7
+ margin: 0;
8
+ }
9
+
10
+ .print main article + article {
11
+ margin-top: 5rem;
12
+ }
13
+
14
+ .print section
15
+ {
16
+ break-before: page;
17
+ break-after: page;
18
+ }
19
+
20
+ .print section:first-child, .print section + section {
21
+ break-before: initial;
22
+ }
23
+
24
+ .print .toc ul
25
+ {
26
+ list-style-position: outside;
27
+ padding-left: 2.5rem;
28
+ }
29
+
30
+ .print .toc .chapter-link
31
+ {
32
+ font-weight: 600;
33
+ list-style-type: none;
34
+ margin-bottom: 0.5rem;
35
+ margin-left: -2.5rem;
36
+ }
37
+
38
+ .print .toc li + .chapter-link {
39
+ margin-top: 1.5rem;
40
+ }
41
+
42
+ @media print
43
+ {
44
+ .print .cover, .print .chapter
45
+ {
46
+ height: 100vh;
47
+ display: flex;
48
+ flex-direction: row;
49
+ justify-content: center;
50
+ align-items: center;
51
+ }
52
+ }
@@ -130,7 +130,7 @@
130
130
  padding: 0 1.5rem;
131
131
  }
132
132
 
133
- article img, article figure, article .table-wrapper {
133
+ article img, article figure, article .pre-wrapper, article .table-wrapper {
134
134
  max-width: calc((100vw - 3rem) - var(--scrollbar-width));
135
135
  }
136
136
 
@@ -165,7 +165,7 @@
165
165
  padding: 0 $header-height;
166
166
  }
167
167
 
168
- article img, article figure, article .table-wrapper {
168
+ article img, article figure, article .pre-wrapper, article .table-wrapper {
169
169
  max-width: calc((100vw - #{$header-height * 2}) - var(--scrollbar-width));
170
170
  }
171
171
 
@@ -5,3 +5,4 @@
5
5
  @import 'layout';
6
6
  @import 'content';
7
7
  @import 'responsive';
8
+ @import 'print';
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-gitbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Rehn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-13 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.8'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '3.8'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -84,9 +90,11 @@ files:
84
90
  - _layouts/chapter-index.html
85
91
  - _layouts/chapter-redirect.html
86
92
  - _layouts/default.html
93
+ - _layouts/print.html
87
94
  - _layouts/root-redirect.html
88
95
  - _sass/_content.scss
89
96
  - _sass/_layout.scss
97
+ - _sass/_print.scss
90
98
  - _sass/_responsive.scss
91
99
  - _sass/_variables.scss
92
100
  - _sass/jekyll-theme-gitbook.scss
@@ -118,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
126
  - !ruby/object:Gem::Version
119
127
  version: '0'
120
128
  requirements: []
121
- rubygems_version: 3.1.2
129
+ rubygems_version: 3.3.23
122
130
  signing_key:
123
131
  specification_version: 4
124
132
  summary: Gem-based Jekyll theme for documentation sites, inspired by GitBook's visual