Coder Social home page Coder Social logo

brandonhimpfen / html-list-builder Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 6 KB

The HTML List Builder is an npm package that allows you to easily create ordered and unordered lists in HTML with class and id attributes as options.

Home Page: https://www.himpfen.com/html-list-builder/

License: MIT License

JavaScript 100.00%
html html-list html5 list ol ul

html-list-builder's Introduction

html-list-builder

npm version

The HTML List Builder is an npm package that allows you to easily create ordered and unordered lists in HTML with class and id attributes as options. It provides a simple and convenient way to generate lists programmatically.

Installation

You can install the HTML List Builder package using npm. Run the following command:

npm install html-list-builder

Usage

To use the HTML List Builder in your project, require it and call the provided functions:

const { createOrderedList, createUnorderedList } = require('html-list-builder');

const items = ['Apple', 'Banana', 'Orange'];
const options = { class: 'fruits', id: 'fruits-list' };

const orderedList = createOrderedList(items, options);
console.log(orderedList);

const unorderedList = createUnorderedList(items, options);
console.log(unorderedList);

The createOrderedList and createUnorderedList functions take an array of items as the first parameter and an options object as the second parameter. The options object can contain class and idattributes to customize the list element.

API

createOrderedList(items, options)

This function generates an ordered list in HTML.

  • items (Array): An array of strings representing the list items.
  • options (Object): An optional object with the following properties:
    • class (String): The class attribute for the <ol> element.
    • id (String): The id attribute for the <ol> element.

Returns: A string containing the generated ordered list HTML.

createUnorderedList(items, options)

This function generates an unordered list in HTML.

  • items (Array): An array of strings representing the list items.
  • options (Object): An optional object with the following properties:
    • class (String): The class attribute for the <ul> element.
    • id (String): The id attribute for the <ul> element.

Returns: A string containing the generated unordered list HTML.

html-list-builder's People

Contributors

brandonhimpfen avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.