Socket
Socket
Sign inDemoInstall

@emmetio/abbreviation

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emmetio/abbreviation

Emmet standalone abbreviation parser


Version published
Weekly downloads
253K
decreased by-20.47%
Maintainers
2
Weekly downloads
 
Created

What is @emmetio/abbreviation?

@emmetio/abbreviation is an npm package that provides a way to parse and transform Emmet abbreviations into structured data. Emmet abbreviations are shorthand syntaxes used to generate HTML and CSS code quickly. This package is useful for developers who want to integrate Emmet-like functionality into their own tools or editors.

What are @emmetio/abbreviation's main functionalities?

Parsing Abbreviations

This feature allows you to parse Emmet abbreviations into a structured tree format. In this example, the abbreviation 'ul>li*3' is parsed into a tree structure representing an unordered list with three list items.

const parse = require('@emmetio/abbreviation');
const tree = parse('ul>li*3');
console.log(tree);

Transforming Abbreviations

This feature allows you to transform the parsed abbreviation tree. In this example, the tree is transformed to include placeholders for fields, which can be useful for creating templates.

const parse = require('@emmetio/abbreviation');
const transform = require('@emmetio/abbreviation/lib/transform');
const tree = parse('ul>li*3');
const transformedTree = transform(tree, { field: (index, placeholder) => `
	${placeholder}` });
console.log(transformedTree);

Stringify Abbreviations

This feature allows you to convert the parsed abbreviation tree back into a string format, such as HTML. In this example, the tree is converted into an HTML string representing an unordered list with three list items.

const parse = require('@emmetio/abbreviation');
const stringify = require('@emmetio/abbreviation/lib/stringify');
const tree = parse('ul>li*3');
const html = stringify(tree);
console.log(html);

Other packages similar to @emmetio/abbreviation

Keywords

FAQs

Package last updated on 10 May 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc