Creates an HTML table of content with links to files from a selected directory.
var folderToc = require("folder-toc");
folderToc("docs");
This will create a table of content for all files in the docs directory.
folderToc("target_directory", {
name: 'index.html',
templateDir: path(__dirname, 'resources/classic'),
templateFile: 'index.jst',
filter: '*.*',
title: 'Files'
});
Type: String
Defaults: 'index.html'
Name of the output file containing the table of content.
Type: String
Location of the template directory. Template directory should contain a template file and all required assets.
Contents of the template directory will be copied to the location where the table of content is created and placed in the '[name]_assets' directory. Set paths to used assets in the template file accordingly.
Type: String
Name of the template file within the template directory.
Type: String
Default: .
Pattern matching files which should be included in the table of content.
Type: String
Default: Files
Table of content file title.
If you would like to create a custom template for the table of content copy and customize the contents of the '/resources/custom' directory.
Create a table of content within the /example directory.
cd example
npm install
npm run example