Skip to content

Commit

Permalink
Add Composer support for plugin installation
Browse files Browse the repository at this point in the history
  • Loading branch information
iridescent-dev committed Sep 29, 2021
1 parent 8994737 commit bf3c964
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Composer
/composer.lock
/vendor
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Iridescent
Copyright (c) 2020-2021 Iridescent

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
43 changes: 29 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,41 @@
Generate a table of contents for the pages of your [Pico](http://picocms.org) site.

- [Pico Table Of Contents Plugin](#pico-table-of-contents-plugin)
- [Usage](#usage)
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Install](#install)
- [Update your theme](#update-your-theme)
- [Configuration settings](#configuration-settings)
- [Example](#example)
- [The `index.md` file](#the-indexmd-file)
- [Screenshot](#screenshot)
- [Example](#example)
- [The `index.md` file](#the-indexmd-file)
- [Screenshot](#screenshot)
- [License](#license)

## Getting Started
* Copy the `TableOfContents` folder into the `plugins` folder of your project.
* Update your theme to include CSS style.
* Define the configuration variables if default values are not suitable.
* Add `<toc />` element where you want the table of contents to appear on your page.

### Usage
## Usage
Automatically generates a table of contents based on the elements `<h1>` to `<h6>` of your page.

In the `.md` file corresponding to your page, simply add the `<toc />` element where you want the table of contents to be inserted. The `<toc />` element must be added for each page you want.

## Getting Started
* [Add the plugin](#install) to your poject.
* [Update your theme](#update-your-theme) to include CSS style.
* [Define the configuration variables](#configuration-settings) if default values are not suitable.
* [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
* using Composer `composer require iridescent-dev/pico-toc-plugin`
* or manually `cd plugins && git clone https://github.com/iridescent-dev/pico-toc-plugin.git TableOfContents`

The structure should be as follows
```
project
└───plugins
└───TableOfContents
│ style.css
│ TableOfContents.php
```

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

Expand Down Expand Up @@ -57,8 +72,8 @@ This configuration will be applied to the entire site, but it's also possible to
<toc max-level="4" heading="Table of Contents" />
```

### Example
#### The `index.md` file
## Example
### The `index.md` file

In this example, the `max-level` is set to 3.

Expand Down Expand Up @@ -98,7 +113,7 @@ Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incid

```

#### Screenshot
### Screenshot
<p align="center">
<img src="Screenshot.png" title="Screenshot">
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Iridescent
* @link https://github.com/iridescent-dev/pico-toc-plugin
* @license http://opensource.org/licenses/MIT The MIT License
* @version 1.1
* @version 1.2
*/
class TableOfContents extends AbstractPicoPlugin
{
Expand Down
36 changes: 36 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "iridescent-dev/pico-toc-plugin",
"description": "A Table Of Contents plugin for Pico CMS.",
"type": "pico-plugin",
"keywords": [ "pico", "picocms", "picocms-plugin", "pico-toc-plugin", "iridescent" ],
"homepage": "https://github.com/iridescent-dev/pico-toc-plugin",
"license": "MIT",
"authors": [
{
"name": "Véronique Seguela",
"email": "veronique@iridescent.dev",
"role": "Lead Developer"
},
{
"name": "Contributors",
"homepage": "https://github.com/iridescent-dev/pico-toc-plugin/graphs/contributors"
}
],
"support": {
"docs": "https://github.com/iridescent-dev/pico-toc-plugin#readme",
"issues": "https://github.com/iridescent-dev/pico-toc-plugin/issues",
"source": "https://github.com/iridescent-dev/pico-toc-plugin"
},
"require": {
"php": ">=7.4",
"picocms/pico": "^2.1"
},
"autoload": {
"classmap": [ "TableOfContents.php", "style.css" ]
},
"extra": {
"installer-name": "TableOfContents"
},
"minimum-stability": "beta",
"prefer-stable": true
}
File renamed without changes.

0 comments on commit bf3c964

Please sign in to comment.