šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

@jsamr/counter-style

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsamr/counter-style

CSS Counter Styles Level 3 and presets

2.0.2
latest
Source
npm
Version published
Weekly downloads
306K
51.97%
Maintainers
1
Weekly downloads
Ā 
Created

What is @jsamr/counter-style?

@jsamr/counter-style is an npm package that allows you to create and use custom counter styles in JavaScript. It is particularly useful for generating custom list markers in web applications, providing a flexible way to define and apply various counter styles.

What are @jsamr/counter-style's main functionalities?

Creating a Custom Counter Style

This feature allows you to create a custom counter style by specifying the type, symbols, and suffix. The example demonstrates creating a numeric counter style with custom symbols and a suffix.

const { counterStyle } = require('@jsamr/counter-style');

const myCustomStyle = counterStyle({
  type: 'numeric',
  symbols: ['A', 'B', 'C', 'D', 'E'],
  suffix: ') '
});

console.log(myCustomStyle.renderMarker(1)); // Output: 'A) '
console.log(myCustomStyle.renderMarker(2)); // Output: 'B) '

Using Predefined Counter Styles

This feature provides access to predefined counter styles such as decimal and lowerAlpha. The example shows how to use these predefined styles to render markers.

const { decimal, lowerAlpha } = require('@jsamr/counter-style/presets');

console.log(decimal.renderMarker(1)); // Output: '1'
console.log(lowerAlpha.renderMarker(1)); // Output: 'a'

Customizing Existing Counter Styles

This feature allows you to customize existing counter styles by modifying their properties. The example demonstrates adding a suffix to the decimal counter style.

const { decimal } = require('@jsamr/counter-style/presets');

const customDecimal = decimal.withSuffix('.');

console.log(customDecimal.renderMarker(1)); // Output: '1.'
console.log(customDecimal.renderMarker(2)); // Output: '2.'
0

Keywords

CSS Counter Styles Level 3

FAQs

Package last updated on 28 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts