html-toc-generator
Advanced tools
Comparing version 0.1.3 to 0.1.4
{ | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"license": "MIT", | ||
@@ -59,2 +59,2 @@ "main": "dist/index.js", | ||
} | ||
} | ||
} |
@@ -58,4 +58,54 @@ # Table of Contents Generator | ||
s | ||
## Example | ||
Suppose we have the following HTML content: | ||
```html | ||
<div id="content"> | ||
<h1>Introduction</h1> | ||
<h2>Section 1</h2> | ||
<h3>Subsection 1.1</h3> | ||
<h3>Subsection 1.2</h3> | ||
<h2>Section 2</h2> | ||
<h3>Subsection 2.1</h3> | ||
<h3>Subsection 2.2</h3> | ||
</div> | ||
``` | ||
After calling the `init` method with the default options, the generated table of contents will be appended to the `<body>` element and will have the following structure: | ||
```html | ||
<div class="toc"> | ||
<ul> | ||
<li> | ||
<a href="#introduction">Introduction</a> | ||
<ul> | ||
<li> | ||
<a href="#section-1">Section 1</a> | ||
<ul> | ||
<li><a href="#subsection-1-1">Subsection 1.1</a | ||
></li> | ||
<li><a href="#subsection-1-2">Subsection 1.2</a></li> | ||
</ul> | ||
</li> | ||
<li> | ||
<a href="#section-2">Section 2</a> | ||
<ul> | ||
<li><a href="#subsection-2-1">Subsection 2.1</a></li> | ||
<li><a href="#subsection-2-2">Subsection 2.2</a></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</div> | ||
``` | ||
Please note that no CSS styles are added by default to keep the library simple and customizable. You can apply your own CSS styles by targeting the generated classes and elements. | ||
## License | ||
This project is licensed under the [MIT License](LICENSE). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50157
111