Skip to content

Commit

Permalink
Merge branch 'release/1.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sommerregen committed Jun 12, 2017
2 parents dbaef77 + e373c47 commit 27ca1a3
Show file tree
Hide file tree
Showing 21 changed files with 1,507 additions and 719 deletions.
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
# v1.4.0
## 06/12/2017

1. [](#new)
* Added new `active` setting that supersedes `process` option
* Added `slug.granularity` option for slug generation
* Added and expose TOC generation (see [#8](https://github.com/Sommerregen/grav-plugin-toc/issues/8))
2. [](#improved)
* Add a "headeranchor" class to the `hx` tag (thanks to [@Lamecarlate](https://github.com/Lamecarlate))
* Moved template to new plugin template location
* Improved styling of code elements in table of contents
* Expose more plugin strings for translations
* Strip tags in title attributes
* Dropped `iconv` dependency
3. [](#bugfix)
* Fixed `{{ page.content|toc }}` not working [#8](https://github.com/Sommerregen/grav-plugin-toc/issues/8)
* Fixed issue with quote boxes that broke links in TOC [#10](https://github.com/Sommerregen/grav-plugin-toc/issues/10)
* Fixed error on multilingual site [#13](https://github.com/Sommerregen/grav-plugin-toc/issues/13) & [#14](https://github.com/Sommerregen/grav-plugin-toc/issues/14)
* Fixed undefined offset error in [MINITOC] [#12](https://github.com/Sommerregen/grav-plugin-toc/issues/12) & [#15](https://github.com/Sommerregen/grav-plugin-toc/issues/15)

# v1.3.1
## 10/24/2015

2. [](#improved)
* Do not render TOC if it is empty. [#6](https://github.com/Sommerregen/grav-plugin-toc/issues/6) & [#7](https://github.com/Sommerregen/grav-plugin-toc/pull/7)
* Do not render TOC if it is empty [#6](https://github.com/Sommerregen/grav-plugin-toc/issues/6) & [#7](https://github.com/Sommerregen/grav-plugin-toc/pull/7)
3. [](#bugfix)
* Fixed [#5](https://github.com/Sommerregen/grav-plugin-toc/pull/5) (Fix typo in `README.md`)

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using Grav Toc Plugin in any way.
MIT LICENSE
-----------

Copyright (c) 2015 Benjamin Regler, https://github.com/sommerregen/grav-plugin-toc
Copyright (c) 2015-2017 Benjamin Regler, https://github.com/sommerregen/grav-plugin-toc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,19 @@ The `Toc` plugin comes with some sensible default configuration, that are pretty
# Global plugin configurations

enabled: true # Set to false to disable this plugin completely
active: true # Option to (de-)activate this plugin on a page
built_in_css: true # Use built-in CSS of the plugin

# Global and page specific configurations

title: true # Title to insert in the Table of Contents
title: true # Title to insert in the table of contents
anchorlink: true # Set to true to cause all headers to link to themselves
permalink: true # Set to true to generate permanent links at the beginning of each header

placement: "left" # Either "left" or "right"
visible: "hover" # Active on "hover" or "always" visible
icon: # Default link or a specific character like: #, ¶, ❡, and §.
class: # Adds the provided class to the anchor html
icon: "#" # Default link or a specific character like: #, ¶, ❡, and §
class: [] # Adds the provided classes to the anchor HTML

baselevel: 1 # Base level for headings
headinglevel: 6 # Maximum heading level to show in TOC
Expand All @@ -58,9 +59,8 @@ slug: # Slug generation
truncate: true # Truncate headings for slug generation
length: 32 # Slug string length
break: "-" # The break delimiter to divide the slug into pieces of words.
pad: "-..." # Added to the end of the truncated slug

process: true # Process table of contents
pad: "..." # Added to the end of the truncated slug
level: "words" # Kind of slug generation (based on "words" or "character")
```
If you need to change any value, then the best process is to copy the [toc.yaml](toc.yaml) file into your `users/config/plugins/` folder (create it if it doesn't exist), and then modify there. This will override the default settings.
Expand Down Expand Up @@ -126,7 +126,7 @@ Thanks!
## License
Copyright (c) 2015 [Benjamin Regler][github]. See also the list of [contributors] who participated in this project.
Copyright (c) 2015-2017 [Benjamin Regler][github]. See also the list of [contributors] who participated in this project.
[Dual-licensed](LICENSE) for use under the terms of the [MIT][mit-license] or [GPLv3][gpl-license] licenses.
Expand Down
124 changes: 63 additions & 61 deletions assets/css/toc.css
Original file line number Diff line number Diff line change
@@ -1,115 +1,117 @@
/* General styles */
.table-of-contents {
font-size: .8em;
display: inline-block;
font-size: .8em;
display: inline-block;
}
.table-of-contents.toc,
.table-of-contents.minitoc {
background-color: #F8F8F8;
box-shadow: 0 0 5px 0 rgba(50, 50, 50, 0.4);
padding: 1em 2em;
min-width: 33.3%;
max-width: 25%;
background-color: #F8F8F8;
box-shadow: 0 0 5px 0 rgba(50, 50, 50, 0.4);
padding: 1em 2em;
min-width: 33.3%;
max-width: 50%;
}
.table-of-contents.toc {
float: right;
margin: 0 0 2em 2em;
float: right;
margin: 0 0 2em 2em;
}

/* TOC elements */
.table-of-contents .toctitle {
display: block;
font-size: larger;
font-weight: bold;
margin-bottom: .5em;
display: block;
font-size: larger;
font-weight: bold;
margin-bottom: .5em;
}
.table-of-contents ul {
list-style: none;
padding: 0;
margin: 0;
list-style: none;
padding: 0;
margin: 0;
}
.table-of-contents > ul {
margin-left: 1.5em;
margin-left: 1.5em;
}
.table-of-contents ul ul {
padding: 0 1em;
padding: 0 1em;
}
.table-of-contents li {
margin: 0 0 .25em;
display: block;
color: #808080;
margin: 0 0 .25em;
display: block;
color: #808080;
}
.table-of-contents .toclink:before {
content: "\00BB"; /* » */
display: inline;
margin-right: 0.5ex;
content: "\00BB"; /* » */
display: inline;
margin-right: 0.5ex;
}
.toclink {
margin-left: -1em;
margin-left: -1em;
}

/* Mini TOC */
.table-of-contents.minitoc {
margin: -1em 0;
margin: -1em 0;
}

/* Blog adjustments */
.list-item {
clear: right;
display: inline-block;
width: 100%;
clear: right;
display: inline-block;
width: 100%;
}

/* Anchorlinks */
.headeranchor-link {
color: inherit;
display: inline-block;
outline: none;
position: relative;
color: inherit;
display: inline-block;
outline: none;
position: relative;
}
.headeranchor-link:before,
.headeranchor-link-left:before {
content: attr(data-icon); /* "\2693" Dingsbat anchor */
display: inline-block;
margin-left: -1em;
padding-right: .3em;
text-align: right;
text-decoration: none;
width: 1em;
content: attr(data-icon); /* "\2693" Dingsbat anchor */
display: inline-block;
margin-left: -1em;
padding-right: .3em;
text-align: right;
text-decoration: none;
width: 1em;

position: relative;
left: -9999px;
height: 0;
opacity: 0;
visibility: hidden;
position: relative;
left: -9999px;
height: 0;
opacity: 0;
visibility: hidden;

transition: opacity .4s ease-in-out 0s
transition: opacity .4s ease-in-out 0s
}
.headeranchor-link:hover:before,
.headeranchor-link.headeranchor-visible-always:before {
left: 0;
height: auto;
opacity: 1;
visibility: visible;
.headeranchor-link.headeranchor-visible--always:before {
left: 0;
height: auto;
opacity: 1;
visibility: visible;
}
.headeranchor-link-right:hover:before,
.headeranchor-link-right.headeranchor-visible-always:before {
left: calc(100% + 1.1em);
.headeranchor-link--right:hover:before,
.headeranchor-link--right.headeranchor-visible--always:before {
left: calc(100% + 1.1em);
}
.headeranchor-link.no-anchor:hover:before {
left: -9999px;
height: 0;
opacity: 0;
visibility: hidden;
left: -9999px;
height: 0;
opacity: 0;
visibility: hidden;
}

/* Toc links */
.toclink code,
.headeranchor-link code {
font-size: inherit;
vertical-align: inherit;
background: none;
color: inherit;
font-size: inherit;
vertical-align: inherit;
}
.toclink:hover code,
.headeranchor-link:hover code {
color: inherit;
color: inherit;
}
57 changes: 37 additions & 20 deletions blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: "Toc"
version: 1.3.1
version: "1.4.0"
description: "This plugin automagically generates a (minified) Table of Contents based on special markers in the document and adds it into the resulting HTML document."
icon: language
icon: "language"
author:
name: Sommerregen
email: [email protected]
homepage: https://github.com/sommerregen/grav-plugin-toc
keywords: [toc, filter, formatter, plugin]
docs: https://github.com/sommerregen/grav-plugin-toc/blob/master/README.md
bugs: https://github.com/sommerregen/grav-plugin-toc/issues
license: MIT/GPL
name: "Sommerregen"
email: "[email protected]"
homepage: "https://github.com/sommerregen/grav-plugin-toc"
keywords: ["toc", "filter", "formatter", "plugin"]
docs: "https://github.com/sommerregen/grav-plugin-toc/blob/master/README.md"
bugs: "https://github.com/sommerregen/grav-plugin-toc/issues"
license: "MIT/GPL"

form:
validation: strict

fields:
global:
type: section
Expand All @@ -31,6 +32,18 @@ form:
validate:
type: bool

active:
type: toggle
label: PLUGINS.TOC.PLUGIN_ACTIVE
help: PLUGINS.TOC.PLUGIN_ACTIVE_HELP
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool

built_in_css:
type: toggle
label: PLUGINS.TOC.BUILTIN_CSS
Expand All @@ -51,6 +64,7 @@ form:
title:
type: toggle
label: PLUGINS.TOC.TITLE
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
Expand All @@ -62,6 +76,7 @@ form:
type: toggle
label: PLUGINS.TOC.ANCHORLINK
help: PLUGINS.TOC.ANCHORLINK_HELP
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
Expand All @@ -73,6 +88,7 @@ form:
type: toggle
label: PLUGINS.TOC.PERMALINK
help: PLUGINS.TOC.PERMALINK_HELP
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
Expand Down Expand Up @@ -136,17 +152,6 @@ form:
min: 1
max: 6

process:
type: toggle
label: PLUGINS.TOC.PROCESS
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool

slug:
type: section
title: PLUGINS.TOC.SLUG.SECTION
Expand All @@ -155,13 +160,25 @@ form:
slug.truncate:
type: toggle
label: PLUGINS.TOC.SLUG.TRUNCATE
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool

slug.granularity:
type: select
size: small
label: PLUGINS.TOC.SLUG.GRANULARITY.LABEL
default: words
options:
words: PLUGINS.TOC.SLUG.GRANULARITY.WORDS
characters: PLUGINS.TOC.SLUG.GRANULARITY.CHARACTERS
validate:
type: string

slug.length:
type: text
size: x-small
Expand Down
Loading

0 comments on commit 27ca1a3

Please sign in to comment.