Gathering detailed insights and metrics for @emmetio/abbreviation
Gathering detailed insights and metrics for @emmetio/abbreviation
The essential toolkit for web-developers
npm install @emmetio/abbreviation
Typescript
Module System
Node Version
NPM Version
99.7
Supply Chain
92.8
Quality
78.5
Maintenance
100
Vulnerability
100
License
TypeScript (99.39%)
JavaScript (0.61%)
Love this project? Help keep it running โ sponsor us today! ๐
Total Downloads
35,414,574
Last Day
19,097
Last Week
332,481
Last Month
1,329,350
Last Year
15,383,055
MIT License
4,493 Stars
280 Commits
522 Forks
155 Watchers
3 Branches
50 Contributors
Updated on Feb 18, 2025
Latest Version
2.3.3
Package Id
@emmetio/abbreviation@2.3.3
Unpacked Size
160.03 kB
Size
33.83 kB
File Count
16
NPM Version
lerna/6.5.1/node@v16.16.0+x64 (darwin)
Node Version
16.16.0
Published on
May 10, 2023
Cumulative downloads
Total Downloads
Last Day
-3.1%
19,097
Compared to previous day
Last Week
4.5%
332,481
Compared to previous week
Last Month
27.3%
1,329,350
Compared to previous month
Last Year
51.4%
15,383,055
Compared to previous year
1
Parses given Emmet markup abbreviation into AST. Parsing is performed in two steps: first it tokenizes given abbreviation (useful for syntax highlighting in editors) and then tokens are analyzed and converted into AST nodes as plain, JSON-serializable objects.
Note that AST tree in most cases cannot be used directly for output: for example, AST node produced from .foo.bar
element misses element name and contains two class
attributes with foo
and bar
values (not a single class
with foo bar
value).
You can install it via npm:
1npm install @emmetio/abbreviation
Then add it into your project:
1import parse from '@emmetio/abbreviation'; 2 3const tree = parse('div#foo>span.bar*3'); 4/* { 5 type: 'Abbreviation', 6 children: [{ 7 type: 'AbbreviationNode', 8 name: 'div', 9 attributes: [...], 10 children: [...] 11 }] 12} */ 13
The returned tree contains AbbreviationNode
items: a node with name, attributes and/or text content. E.g. an element that can be represented somehow. Repeated and grouped nodes like a>(b+c)*3
are automatically converted and duplicated as distinct AbbreviationNode
with distinct .repeat
property which identifies node in repeating sequence.
Emmet abbreviation element has the following basic parts:
name.class#id[attributes?, ...]{text value}*repeater/
name
โ element name, like div
, span
etc. Stored as node.name
property.[attributes]
โ list of attributes. Each attribute is stored as AbbreviationAttribute
instance and can be accessed by node.getAttribute(name)
. Each attribute can be written in different formats:
attr
โ attribute with empty value.attr=value
โ attribute with value. The value
may contain any character except space or ]
.attr="value"
or attr='value'
โ attribute with value in quotes. Quotes are automatically removed. Expression values like attr={value}
are supported and can be identified by valueType: "expression"
property.attr.
โ boolean attribute, e.g. attribute without value, like required
in <input>
.!attr
โ implicit attribute, will be outputted if its value is not empty. Used as a placeholder to preserve attribute order in output../non/attr/value
โ value for default attribute. In other words, anything that doesnโt match a attribute name characters. Can be a single- or double-quotted as well. Default attribute is stored with null
as name and should be used later, for example, to resolve predefined attributes..class
โ shorthand for class
attribute. Note that an element can have multiple classes, like .class1.class2.class3
.#id
โ shorthand for id
attribute.{text}
โ nodeโs text content*N
โ element repeater, tells parser to create N
copies of given node./
โ optional self-closing operator. Marks element with node.selfClosing = true
.Each element of abbreviation must be separated with any of these operators:
elem1+elem2>elem3
+
โ sibling operator, adds next element as a next sibling of current element in tree.>
โ child operator, adds next element as a child of current element.^
โ climb-up operator, adds next element as a child of current elementโs parent node. Multiple climb-up operators are allowed, each operator moves one level up by tree.A set of elements could be grouped using ()
, mostly for repeating and for easier elements nesting:
a>(b>c+d)*4+(e+f)
Groups can be optionally concatenated with +
operator.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 commit(s) and 4 issue activity found in the last 90 days -- score normalized to 6
Reason
Found 13/30 approved changesets -- score normalized to 4
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
18 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More