document-outliner
A utility to make ol/ul list by using html5 outline algorithm.
Specifications
Installation
Vanilla (Plain JavaScript)
via npm
npm install document-outliner
via yarn
yarn add document-outliner
vid cdn
jQuery plugin
via cdn
Usage
Vanilla (Plain JavaScript)
; const outliner = '.js-outline-src';outliner;
jQuery
;
Options
name | description | default |
---|---|---|
link | create HTML anchor link | true |
listType | HTML list type ('ol'|'ul') | 'ol' |
listClassName | ol/ul class name | '' |
itemClassName | li class name | '' |
linkClassName | link class name | '' |
anchorName | anchor link name ($1 is to be link number) | 'heading-$1' |
levelLimit | limit on number of level | 99 |
Example
HTML
The Tax Book Earning money Earning money is good. Getting a job To earn money you typically need a job. Spending money Spending is what money is mainly used for. Cheap things Buying cheap things often not cost-effective. Expensive things The most expensive thing is often not the most cost-effective either. Investing money You can lend your money to other people. Losing money If you spend money or invest money, sooner or later you will lose money. Poor judgement Usually if you lose money it's because you made a mistake.
JavaScript
const outliner = '.container';outliner;
Yield
The Tax Book Earning money Getting a job Spending money Cheap things Expensive things Investing money Losing money Poor judgement The Tax Book Earning money Earning money is good. Getting a job To earn money you typically need a job. Spending money Spending is what money is mainly used for. Cheap things Buying cheap things often not cost-effective. Expensive things The most expensive thing is often not the most cost-effective either. Investing money You can lend your money to other people. Losing money If you spend money or invest money, sooner or later you will lose money. Poor judgement Usually if you lose money it's because you made a mistake.