Add README.md

This commit is contained in:
Alex Shpak 2018-09-13 18:07:55 +02:00
parent f4bcc2ecd9
commit e62448627e
6 changed files with 127 additions and 35 deletions

85
README.md Normal file
View File

@ -0,0 +1,85 @@
# Hugo Book Theme
### Documentation theme as simple as plain book
Description, motivation
![Screenshot](images/screenshot.png)
## Features
* Clean simple design
* Mobile friendly
* Customizable menu
* Renders single site section (`docs` by default)
## Installation
```
git clone ...
```
## Configuration
### Menu
There are two options to render menu:
1. Use file tree as menu (Option by default).
You can set `title` and `weight` in front matter to adjust menu.
2. Use leaf bundle and content of it's `index.md` as
menu.
You can enable it by pointing to leaf bundle with `BookMenuBundle` parameter on Site level.
```md
- [**Introduction**](/docs/introduction/)
- [Motivation](/docs/motivation/)
- [Configuration](/docs/configuration/)
- [Server](/docs/configuration/server/)
- [Client](/docs/configuration/client/)
<br />
- [Addtional Information](docs/configuration/additional-information/)
- [*Links*](/docs/links/)
```
Also see [Example](exampleSite/content/menu) and [Site configuration](#site-configuration)
### Site configuration
There is few configuration options you can add to your `config.yml|json|toml` file
```yaml
# (Optional) Set this to true if you use captial letters in file names
disablePathToLower: true
params:
# (Optional, default true) Show or hide table of contents globally
# You can also specify this parameter per page in front matter
BookShowToC: true
# (Optional, default none) Set leaf bundle to render side menu
# When not specified file structure and weights will be used
# See https://gohugo.io/content-management/page-bundles/
BookMenuBundle: /docs/menu
# (Optional, default docs) Specify section of content to render as menu
# You can also set value to "*" to render all sections to menu
BookSection: docs
```
### Per document configuration
You can specify additional params per document in front matter
```yaml
---
# Set type to 'docs' if you want to render page outside of configured section
type: docs
# Set page weight to re-arrange items in file-tree menu (if BookMenuBundle not set)
weight: 10
# Set to mark page as top level section in file-tree menu (if BookMenuBundle not set)
bookTopSection: true
# Set to hide table of contents, default true
bookShowToC: false
---
```
## License
[MIT](LICENSE)

View File

@ -1,9 +1,8 @@
@import 'variables';
html, button, input, select, textarea, .pure-g [class *= "pure-u"] {
font-family: "Open Sans", "Roboto", sans-serif;
font-weight: 300;
font-family: Roboto, sans-serif;
font-weight: $body-font-weight;
}
.pure-g {
@ -30,12 +29,11 @@ html, button, input, select, textarea, .pure-g [class *= "pure-u"] {
// font weight only for root sections
> li > .section {
font-weight: 600;
font-weight: 700;
}
}
.pure-menu-link, .pure-menu-heading {
color: $gray-800;
padding: $padding-4 $padding-16;
text-transform: capitalize;
}
@ -44,12 +42,4 @@ html, button, input, select, textarea, .pure-g [class *= "pure-u"] {
&:hover, &.active {
background: none;
}
&:hover {
color: $gray-600;
}
&.active {
color: $color-link;
}
}

View File

@ -9,8 +9,8 @@ $font-size-14: .875rem;
$font-size-16: 1rem;
$size-48: 3rem;
$size-56: 3.5rem;
$size-72: 4.5rem;
// $size-56: 3.5rem;
// $size-72: 4.5rem;
// Grayscale
$white: #fff;
@ -28,9 +28,17 @@ $black: #000;
$color-link: #1177EE;
$color-visited-link: #7823c9;
$body-background: none;
$body-font-color: $gray-800;
$body-font-weight: 300;
$body-line-height: 1.75;
$body-min-width: 25rem;
$nav-background: $gray-100;
$nav-link-color: $gray-800;
$nav-menu-width: 18rem;
$toc-menu-width: 14rem;
$content-max-width: 64rem;
$content-min-width: $body-min-width;
$nav-menu-width: 18rem;
$toc-menu-width: 14rem;

View File

@ -13,7 +13,8 @@ html, body {
}
body {
color: $gray-800;
color: $body-font-color;
background: $body-background;
line-height: $body-line-height;
}
@ -24,7 +25,12 @@ a {
.book-brand {
padding: 0 $padding-16;
font-weight: 300;
font-weight: 400;
a {
padding: 0 $padding-16;
color: $body-font-color;
}
}
// Navigation styles
@ -41,26 +47,26 @@ a {
overflow-y: auto;
font-size: $font-size-14;
background: $gray-100;
background: $nav-background;
}
ul {
list-style: none;
padding-left: $padding-16;
}
a {
display: block;
color: $gray-800;
padding: $padding-4 $padding-16;
text-transform: capitalize;
&[href]:hover {
color: $gray-600;
}
&.active {
color: $color-link;
a {
display: block;
color: $nav-link-color;
padding: $padding-4 $padding-16;
text-transform: capitalize;
&[href]:hover {
opacity: 0.5;
}
&.active {
color: $color-link;
}
}
}
@ -126,5 +132,7 @@ a {
// Print styles
@media print {
.book-nav, .book-toc {
display: none;
}
}

BIN
images/.DS_Store vendored

Binary file not shown.

View File

@ -29,7 +29,8 @@
<div class="pure-u book-page markdown">
{{ block "main" . }} {{- .Content -}} {{ end }}
</div>
{{ if and (default true .Site.Params.BookShowTOC) (.Page.TableOfContents) }}
{{ $showToC := default (default true .Site.Params.BookShowToC) .Params.bookshowtoc }}
{{ if and ($showToC) (.Page.TableOfContents) }}
<div class="pure-u book-toc">
{{ partial "docs/toc" . }}
</div>