Bullets
Generate a plain-text or markdown formatted list, with proper indentation, bullets, numbers, letters, roman numerals or custom characters
Install / Use
/learn @jonschlinkert/BulletsREADME
bullets

Generate a plain-text and markdown formatted lists or tables of contents, with proper indentation, bullets, numbers, letters, roman numerals or custom characters.
Install
Install with npm:
$ npm i bullets --save
Usage
var bullets = require('bullets');
Examples
Roman numerals
var list = [
{text: 'Item a...', lvl: 0},
{text: 'Item b...', lvl: 1},
{text: 'Item c...', lvl: 2},
{text: 'Item d...', lvl: 2},
{text: 'Item e...', lvl: 2},
];
// let's generate 100 numerals, in case our list grows.
var actual = bullets(list, {chars: '1..100'}, function (ch) {
return romanize(ch) + '.';
});
Results in:
I. Item a...
II. Item b...
III. Item c...
III. Item d...
III. Item e...
API
bullets
Pass an array of list-item objects to generate a formatted list or table of contents. Uses list-item for generating the actual items.
Note that lvl or level may be passed as the property name in the
following examples.
Params
list{Array}: Array of item objects withtextandlvlpropertieslist.text{String}: The text for the list item.list.lvl{Number}: The level of the list item to be used for indenting the list.opts{Object}: Options to pass to list-item.fn{Function}: pass a function to modify the bullet for an item as it's generated.
Example
var list = [
{text: 'This is item 1', lvl: 0},
{text: 'This is item 2', lvl: 0},
{text: 'This is item 3', lvl: 0},
{text: 'This is sub-item A', lvl: 2},
{text: 'This is sub-item B', lvl: 2},
{text: 'This is sub-item C', lvl: 2},
];
bullets([{text: 'This is a list item', lvl: 0}]);
// Results in
// '- This is item 1'
// '- This is item 2'
// '- This is item 3'
// ' * This is sub-item A'
// ' * This is sub-item B'
// ' * This is sub-item C'
Related projects
list-item: Generate a single formatted list item, allowing you to easily generate lists with proper indentation,… more | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb on January 19, 2016.
Related Skills
node-connect
347.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
