Gathering detailed insights and metrics for literate-postcss
Gathering detailed insights and metrics for literate-postcss
Gathering detailed insights and metrics for literate-postcss
Gathering detailed insights and metrics for literate-postcss
Write CSS documentation with Markdown and then transform it into CSS.
npm install literate-postcss
Typescript
Module System
Min. Node Version
Node Version
NPM Version
64.8
Supply Chain
96.6
Quality
72.3
Maintenance
50
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
9 Stars
3 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jan 28, 2023
Latest Version
1.0.0
Package Id
literate-postcss@1.0.0
Size
5.23 kB
NPM Version
3.10.8
Node Version
6.9.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
27
Write CSS documentation with Markdown and then transform it into CSS.
With npm do:
npm install literate-postcss --save
See the examples
directory for some ideas on how you can use
literate-postcss. If you're using literate-postcss for your styles, please
feel free to get in touch and we'll list your site here.
literate-postcss allows you to write Markdown files with embedded CSS code, and then transform them into a format that can be processed by PostCSS. It's a way of writing stylesheets that is more like a short-form article, and is great for documentation focused use cases such as style guides or pattern libraries.
Because this tool is based on open standards, there's no new language that you need to learn, or plugin that you need to install in your editor to enable syntax highlighting, beyond support for CSS & Markdown. If you use Atom, for instance, there's a Markdown preview that works extremely well with this format.
Writing CSS in this way allows you to take any Markdown previewer to your styles and instantly transform them into beautiful documentation. There's no docblock convention to follow, and you can write as much or as little supporting text as you would like. You can also use headings and links to help structure and add meaning to your stylesheet.
The following parsers have been tested and are known to work out of the box:
Note that as literate-postcss is a wrapper for the PostCSS options object, it should not be used as a traditional plugin. See the examples for details.
Parameters
opts
[Object] Same as the PostCSS options,
plus:
opts.start
[String] This string is used to begin the comment block.opts.middle
[String] This string is prepended to each comment block
line, other than the start
& end
lines.opts.end
[String] This string is used to end the comment block.opts.stripComments
[Boolean] Setting to true
removes any
non-code blocks when parsing Markdown. Note that this option does not
analyse comments within code blocks and therefore will not strip them. (optional, default false
)opts.languages
[Array] This sets the
languages that will not be converted into comments, and should be anything
that a PostCSS parser is capable of parsing. (optional, default ['css','less','scss','sss']
)Examples
Basic usage
1import postcss from 'postcss'; 2import literate from 'literate-postcss'; 3 4const markdown = `# Hello! 5 6 h1 { 7 color: blue; 8 }`; 9 10postcss().process(markdown, literate()).then(result => { 11 console.log(result.content); 12 // /* 13 // * # Hello! 14 // *\/ 15 // h1 { 16 // color: blue; 17 // } 18});
Usage with postcss-less
1import postcss from 'postcss'; 2import less from 'postcss-less-engine'; 3import literate from 'literate-postcss'; 4 5const markdown = `# Hello! 6 7 h1 { 8 width: (1 + 1); 9 }`; 10 11postcss(less).process(markdown, literate({parser: less.parser})).then(result => { 12 console.log(result.content); 13 // /* * # Hello! *\/ 14 // h1 { 15 // width: 2; 16 // } 17});
Usage with postcss-scss
1import postcss from 'postcss'; 2import scss from 'postcss-scss'; 3import literate from 'literate-postcss'; 4 5const markdown = `# Hello! 6 7 .#{class} { 8 color: blue; 9 }`; 10 11postcss().process(markdown, literate({syntax: scss})).then(result => { 12 console.log(result.content); 13 // /* 14 // * # Hello! 15 // *\/ 16 // .#{class} { 17 // color: blue; 18 // } 19});
Usage with sugarss
1import postcss from 'postcss'; 2import sugarss from 'sugarss'; 3import literate from 'literate-postcss'; 4 5const markdown = `# Hello! 6 7 h1 8 color: blue 9`; 10 11postcss().process(markdown, literate({syntax: sugarss})).then(result => { 12 console.log(result.content); 13 // /* 14 // * # Hello! *\/ 15 // h1 16 // color: blue 17});
Thanks goes to these wonderful people (emoji key):
Ben Briggs 💻 📖 👀 ⚠️ |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
MIT © Ben Briggs
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
project is archived
Details
Reason
Found 0/3 approved changesets -- score normalized to 0
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
Score
Last Scanned on 2025-07-14
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