Skip to content

Commit

Permalink
Fix #6 min-level and max-level can be equal
Browse files Browse the repository at this point in the history
  • Loading branch information
iridescent-dev committed Oct 15, 2021
1 parent 7b339f7 commit 4e38b32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,30 @@ In the `.md` file corresponding to your page, simply add the `<toc />` element w
* [Use it](#usage) by adding `<toc />` element where you want the table of contents to appear on your page.

### Install
Extract a copy of the plugin in the `plugins` folder of your project
Extract a copy of the plugin in the plugins directory of your project
* using Composer `composer require iridescent-dev/pico-toc-plugin`
* or manually `git clone https:/iridescent-dev/pico-toc-plugin.git plugins/TableOfContents`
* or manually by copying the `style.css` and `TableOfContents.php` files in a `TableOfContents` folder

The structure should be as follows
```
project
pico
└───plugins
└───TableOfContents
│ style.css
│ TableOfContents.php
```
Replace `pico` with your Pico project directory.
Replace `plugins` with your plugins directory.

### Update your theme
In your template files, add the plugin's CSS style in the `head` section:

``` html
<!-- index.twig -->
``` twig
<!-- index.twig and/or page.twig, etc. -->
<head>
...
<!-- Table Of Contents -->
<link rel="stylesheet" href="{{ base_url }}/plugins/TableOfContents/style.css">
<link rel="stylesheet" href="{{ plugins_url }}/TableOfContents/style.css">
...
</head>
```
Expand Down
4 changes: 2 additions & 2 deletions TableOfContents.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Iridescent
* @link https:/iridescent-dev/pico-toc-plugin
* @license http://opensource.org/licenses/MIT The MIT License
* @version 1.3
* @version 1.4
*/
class TableOfContents extends AbstractPicoPlugin
{
Expand Down Expand Up @@ -83,7 +83,7 @@ public function onContentParsed(&$content)
$max_level = $this->max_level;
}

if ($min_level >= $max_level) {
if ($min_level > $max_level) {
return; // No level to display
}

Expand Down

0 comments on commit 4e38b32

Please sign in to comment.