Skip to content

Commit 0a5edea

Browse files
authored
Merge pull request just-the-docs#19 from pmarsceill/task-lists
Task lists
2 parents 4b8e051 + 32b708c commit 0a5edea

File tree

17 files changed

+182
-15
lines changed

17 files changed

+182
-15
lines changed

_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ baseurl: "/just-the-docs/" # the subpath of your site, e.g. /blog
2121
permalink: pretty
2222
exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"]
2323

24+
# Enable or disable the site search
25+
search_enabled: true
26+
2427
# Aux links for the upper right navigation
2528
aux_links:
2629
"Just the Docs on GitHub":

_includes/head.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
<title>{{ page.title }} - {{ site.title }}</title>
66
<link rel="stylesheet" href="{{ "/assets/css/just-the-docs.css" | absolute_url }}">
7+
{% if site.search_enabled != nil %}
78
<script type="text/javascript" src="{{ "/assets/js/vendor/lunr.min.js" | absolute_url }}"></script>
9+
{% endif %}
810
<script type="text/javascript" src="{{ "/assets/js/just-the-docs.js" | absolute_url }}"></script>
911

1012
<meta name="viewport" content="width=device-width, initial-scale=1">

_layouts/default.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616
</div>
1717
<div class="main-content-wrap">
1818
<div class="page-header">
19-
<div class="main-content pb-0">
19+
<div class="main-content">
20+
{% if site.search_enabled != nil %}
2021
<div class="search js-search">
2122
<div class="search-input-wrap">
2223
<input type="text" class="js-search-input search-input" placeholder="Search {{ site.title }}" aria-label="Search {{ site.title }}" autocomplete="off">
2324
<svg width="14" height="14" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" class="search-icon"><title>Search</title><g fill-rule="nonzero"><path d="M17.332 20.735c-5.537 0-10-4.6-10-10.247 0-5.646 4.463-10.247 10-10.247 5.536 0 10 4.601 10 10.247s-4.464 10.247-10 10.247zm0-4c3.3 0 6-2.783 6-6.247 0-3.463-2.7-6.247-6-6.247s-6 2.784-6 6.247c0 3.464 2.7 6.247 6 6.247z"/><path d="M11.672 13.791L.192 25.271 3.02 28.1 14.5 16.62z"/></g></svg>
2425
</div>
2526
<div class="js-search-results search-results-wrap"></div>
2627
</div>
28+
{% endif %}
2729
{% if site.aux_links != nil %}
28-
<ul class="list-style-none text-small mt-md-2 pb-4 pb-md-0 js-aux-nav aux-nav">
30+
<ul class="list-style-none text-small mt-md-1 mb-md-1 pb-4 pb-md-0 js-aux-nav aux-nav">
2931
{% for link in site.aux_links %}
3032
<li class="d-inline-block my-0{% unless forloop.last %} mr-2{% endunless %}"><a href="{{ link.last }}">{{ link.first }}</a></li>
3133
{% endfor %}

_sass/content.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,23 @@
5656
}
5757
}
5858

59+
.task-list {
60+
padding-left: 0;
61+
}
62+
63+
.task-list-item {
64+
display: flex;
65+
align-items: center;
66+
67+
&::before {
68+
content: "";
69+
}
70+
}
71+
72+
.task-list-item-checkbox {
73+
margin-right: 0.6em;
74+
}
75+
5976
hr + * {
6077
margin-top: 0;
6178
}

_sass/layout.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,18 @@
7979

8080
@include mq(md) {
8181
background-color: $white;
82-
border-bottom: $border $border-color;
83-
8482
}
8583

8684
.main-content {
8785
padding-top: 0;
8886

8987
@include mq(md) {
9088
display: flex;
91-
justify-content: space-between;
89+
justify-content: flex-end;
90+
height: 60px;
9291
padding-top: $sp-4;
92+
padding-bottom: $sp-4;
93+
border-bottom: $border $border-color;
9394
}
9495
}
9596
}

_sass/navigation.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
z-index: 101;
1515
height: 60px;
1616
padding-top: $sp-4;
17-
box-shadow: inset 0 -1px 0 $border-color;
17+
border-bottom: $border $border-color;
1818
}
1919
}
2020

_sass/search.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
display: block;
1818
padding-top: $sp-1;
1919
padding-right: 0;
20-
padding-bottom: $sp-4;
20+
padding-bottom: 0;
2121
padding-left: 0;
2222
margin-bottom: 0;
2323
background-color: transparent;

assets/js/just-the-docs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ function initSearch() {
155155

156156
function ready(){
157157
toggleNav();
158-
initSearch();
158+
if (typeof lunr !== 'undefined') {
159+
initSearch();
160+
}
159161
}
160162

161163
// in case the document is already rendered

docs/configuration.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
layout: default
3+
title: Configuration
4+
nav_order: 2
5+
---
6+
7+
# Configuration
8+
9+
Just the Docs has some specific configuration parameters that can be definied in your Jekyll site's `config.yml` file.
10+
11+
## Search enabled
12+
13+
```yml
14+
# Enable or disable the site search
15+
search_enabled: true
16+
```
17+
18+
## Aux links
19+
20+
```yml
21+
# Aux links for the upper right navigation
22+
aux_links:
23+
"Just the Docs on GitHub":
24+
- "//github.com/pmarsceill/just-the-docs"
25+
```

docs/customization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Customization
4-
nav_order: 5
4+
nav_order: 6
55
---
66

77
# Customization

docs/index-test.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ end
9494
- level 2 item
9595
- level 1 item
9696

97+
### And a task list
98+
99+
- [ ] Hello, this is a TODO item
100+
- [ ] Hello, this is another TODO item
101+
- [x] Goodbye, this item is done
102+
97103
### Small image
98104

99105
![](https://assets-cdn.github.com/images/icons/emoji/octocat.png)

docs/navigation-structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Navigation Structure
4-
nav_order: 4
4+
nav_order: 5
55
---
66

77
# Navigation Structure

docs/search.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Search
4-
nav_order: 6
4+
nav_order: 7
55
---
66

77
# Search
@@ -12,7 +12,9 @@ Just the docs uses [lunr.js](http://lunrjs.com) to add a client-side search inte
1212
- Page content
1313
- Page URL
1414

15-
## Setup search
15+
## Set up search
16+
17+
### 1. Generate search index
1618

1719
Before you can use search, you must initialize the feature by running this
1820
rake command that comes with the `just-the-docs`
@@ -41,3 +43,12 @@ your search index. Alternatively, you can create the file manually in the
4143
```
4244

4345
_Note: If you don't run this rake command or create this file manually, search will not work (or it will use the search index data from this docs site, not your site's content)._
46+
47+
### 2. Enable search in configuration
48+
49+
In your site's `_config.yml` enable search:
50+
51+
```yml
52+
# Enable or disable the site search
53+
search_enabled: true
54+
```

docs/ui-components/code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Code
44
parent: UI Components
5-
nav_order: 5
5+
nav_order: 6
66
---
77

88
# Code

docs/ui-components/lists.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
layout: default
3+
title: Lists
4+
parent: UI Components
5+
nav_order: 5
6+
---
7+
8+
# Lists
9+
{:.no_toc}
10+
11+
## Table of contents
12+
{: .no_toc .text-delta }
13+
14+
1. TOC
15+
{:toc}
16+
17+
---
18+
19+
Most lists can be rendered with pure markdown...
20+
21+
## Unordered list
22+
<div class="code-example" markdown="1">
23+
- Item 1
24+
- Item 2
25+
- Item 3
26+
27+
_or_
28+
29+
* Item 1
30+
* Item 2
31+
* Item 3
32+
</div>
33+
```markdown
34+
- Item 1
35+
- Item 2
36+
- Item 3
37+
38+
_or_
39+
40+
* Item 1
41+
* Item 2
42+
* Item 3
43+
```
44+
45+
46+
## Ordered list
47+
<div class="code-example" markdown="1">
48+
1. Item 1
49+
1. Item 2
50+
1. Item 3
51+
</div>
52+
```markdown
53+
1. Item 1
54+
1. Item 2
55+
1. Item 3
56+
```
57+
## Task list
58+
59+
<div class="code-example" markdown="1">
60+
- [ ] hello, this is a todo item
61+
- [ ] hello, this is another todo item
62+
- [x] goodbye, this item is done
63+
</div>
64+
```markdown
65+
- [ ] hello, this is a todo item
66+
- [ ] hello, this is another todo item
67+
- [x] goodbye, this item is done
68+
```
69+
70+
## Definition list
71+
72+
Definition lists require HTML syntax and aren't supported with the GitHub flavored markdown compiler.
73+
74+
<div class="code-example" markdown="1">
75+
<dl>
76+
<dt>Name</dt>
77+
<dd>Godzilla</dd>
78+
<dt>Born</dt>
79+
<dd>1952</dd>
80+
<dt>Birthplace</dt>
81+
<dd>Japan</dd>
82+
<dt>Color</dt>
83+
<dd>Green</dd>
84+
</dl>
85+
</div>
86+
```html
87+
<dl>
88+
<dt>Name</dt>
89+
<dd>Godzilla</dd>
90+
<dt>Born</dt>
91+
<dd>1952</dd>
92+
<dt>Birthplace</dt>
93+
<dd>Japan</dd>
94+
<dt>Color</dt>
95+
<dd>Green</dd>
96+
</dl>
97+
```
98+

docs/ui-components/ui-components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: UI Components
4-
nav_order: 2
4+
nav_order: 3
55
has_children: true
66
parent: UI Components
77
permalink: /ui-components

docs/utilities/utilities.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Utilities
4-
nav_order: 3
4+
nav_order: 4
55
parent: Utilities
66
has_children: true
77
permalink: /utilities

0 commit comments

Comments
 (0)