File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 22Package for generating table of contents for the text.
33
44For example, you have next text:
5- ```
5+ ``` html
66<h1 >Header first level</h1 >
77Some text here
88<h2 >Header second level</h2 >
@@ -42,20 +42,20 @@ composer require alutskevich/table-contents
4242],
4343```
4444Then add the facade to your aliases array:
45- ```
45+ ``` php
4646'aliases' => [
4747 ...
4848 'TableContents' => Lutskevich\TOC\TableContentsServiceProvider::class,
4949],
5050```
5151### Usage
52- ```
52+ ``` php
5353//return string table contents
5454TableContents::arrayTableContents($text);
5555```
5656
5757Table of contents have next structure:
58- ```
58+ ``` php
5959"0": {
6060 "title": "Title",
6161 "link": "link"
@@ -94,7 +94,7 @@ Table of contents have next structure:
9494* ** link** - anchor link. If text have few same headers links of them will be
9595` <link>-<number> ` (for example: link-1, link-2, link-3).
9696
97- ```
97+ ``` php
9898//Add ID attribute to the headers. Need for anchors.
9999TableContents::setHeaderLinks($text)
100100```
You can’t perform that action at this time.
0 commit comments