
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@progress/dss
Advanced tools
This is a fork of DSS.
DSS, Documented Style Sheets, is a comment styleguide and parser for CSS, LESS, SASS and SCSS code.
In most cases, you will want to include the DSS parser in a build step that will generate documentation files automatically.
/**
* @name Button
* @description Your standard form button.
*
* @state :hover - Highlights when hovering.
* @state :disabled - Dims the button when disabled.
* @state .primary - Indicates button is the primary action.
* @state .smaller - A smaller button.
*
* @example
* <span>
* <button>This is a button</button>
* </span>
*
* @deprecated 123.321
* @deprecatedDescription This is deprecated.
*
* @group Buttons
* @type Color
* @subtype Text-Color
* @key $button-bg
*
* @param {string} par1 - ParmOne description.
* @param {function} par2 - ParamTwo description.
* @returns {number} - Return description.
*/
/// @name Button
/// @description Your standard form button.
///
/// @state :hover - Highlights when hovering.
/// @state :disabled - Dims the button when disabled.
/// @state .primary - Indicates button is the primary action.
/// @state .smaller - A smaller button.
///
/// @example
/// <span>
/// <button>This is a button</button>
/// </span>
///
/// @deprecated 123.321
/// @deprecatedDescription This is deprecated.
///
/// @group Buttons
/// @type Color
/// @subtype Text-Color
/// @key $button-bg
///
/// @param {string} par1 - ParmOne description.
/// @param {function} par2 - ParamTwo description.
/// @returns {number} - Return description.
///
// Require/read a file
const fs = require('fs');
const dss = require('dss');
const file = fs.readFileSync('styles.scss');
// Run DSS Parser
dss.parse(file, {}, (parsed) => {
console.log(parsed.blocks);
});
[{
"name": "Button",
"description": "Your standard form button.",
"state": [
{
"name": ":hover",
"escaped": "pseudo-class-hover",
"description": "Highlights when hovering."
},
{
"name": ":disabled",
"escaped": "pseudo-class-disabled",
"description": "Dims the button when disabled."
},
{
"name": ".primary",
"escaped": "primary",
"description": "Indicates button is the primary action."
},
{
"name": ".smaller",
"escaped": "smaller",
"description": "A smaller button."
}
],
"example": {
"example": " <span>\n <button>This is a button</button>\n </span>",
"escaped": " <span>\n <button>This is a button</button>\n </span>"
},
"deprecated": "123.321",
"deprecatedDescription": "This is deprecated.",
"group": "buttons",
"type": "color",
"subtype": "text-color",
"key": "$button-bg",
"param": [
{
"type": "{string}",
"name": "par1",
"description": "ParmOne description."
},
{
"type": "{function}",
"name": "par2",
"description": "ParmTwo description."
}
],
"returns": {
"type": "{number}",
"name": null,
"description": "Return description."
}
}]
description
and example
parsers allow usage of multi-line comments.description
. However, if a description
annotation is available, the parser overrides the non-annotation one.example
is provided, the parser returns an array of examples.state
and param
parsers are returning an array of all the relevant annotations.type
and key
values based on the next line.group
, type
, and subtype
parsers convert the string annotation to lowercase letters.The parser aliases set their value in the key
of the main parser in the output JSON
.
DSS, by default, includes the following alias
- parser
pairs:
return
- returns
markup
- example
DSS, by default, includes the name
, description
, state
, example
, deprecated
, deprecatedDescription
, group
, type
, subtype
, key
, param
, and returns
parsers of a comment block. You can add to or override these default parsers using the following:
// Matches @link
dss.parser('link', (i, line, block, file) => {
// Replace link with HTML wrapped version
const exp = /(b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig;
return line.replace(exp, "<a href='$1'>$1</a>");
});
// Matches @version
dss.parser('version', (i, line, block, file) => {
return line;
});
1.0.1 (2021-03-02)
FAQs
Documented Style Sheets
The npm package @progress/dss receives a total of 101 weekly downloads. As such, @progress/dss popularity was classified as not popular.
We found that @progress/dss demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.