Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-toc-generator

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-toc-generator - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

4

package.json
{
"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).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc