Gathering detailed insights and metrics for postcss-markdown
Gathering detailed insights and metrics for postcss-markdown
Gathering detailed insights and metrics for postcss-markdown
Gathering detailed insights and metrics for postcss-markdown
npm install postcss-markdown
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2 Stars
106 Commits
4 Watching
12 Branches
7 Contributors
Updated on 14 Sept 2023
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0.8%
46,800
Compared to previous day
Last week
4.5%
245,737
Compared to previous week
Last month
6.2%
997,942
Compared to previous month
Last year
-31.8%
13,017,871
Compared to previous year
5
25
PostCSS syntax for parsing Markdown
First thing's first, install the module:
1npm install postcss-markdown --save-dev
If you want support SCSS/SASS/LESS/SugarSS syntax, you need to install the corresponding module.
1const postcss = require("postcss"); 2const syntax = require("postcss-markdown")({ 3 // Enable support for HTML (default: true) 4 htmlInMd: true, 5 // syntax for parse scss (non-required options) 6 scss: require("postcss-scss"), 7 // syntax for parse less (non-required options) 8 less: require("postcss-less"), 9 // syntax for parse css blocks (non-required options) 10 css: require("postcss-safe-parser"), 11}); 12const autoprefixer = require("autoprefixer"); 13postcss([autoprefixer]) 14 .process(source, { syntax: syntax }) 15 .then(function (result) { 16 // An alias for the result.css property. Use it with syntaxes that generate non-CSS output. 17 result.content; 18 });
input:
# title
```css
::placeholder {
color: gray;
}
```
output:
# title
```css
::-moz-placeholder {
color: gray;
}
:-ms-input-placeholder {
color: gray;
}
::placeholder {
color: gray;
}
```
If you want support SCSS/SASS/LESS/SugarSS syntax, you need to install these module:
1const options = { 2 rules: [ 3 { 4 // custom language 5 test: /^postcss$/i, 6 lang: "scss", 7 }, 8 { 9 // custom language 10 test: /^customcss$/i, 11 lang: "custom", 12 }, 13 ], 14 15 // custom parser for CSS (using `postcss-safe-parser`) 16 css: "postcss-safe-parser", 17 // custom parser for SASS (PostCSS-compatible syntax.) 18 sass: require("postcss-sass"), 19 // custom parser for SCSS (by module name) 20 scss: "postcss-scss", 21 // custom parser for LESS (by module path) 22 less: require.resolve("./node_modules/postcss-less"), 23 // custom parser for SugarSS 24 sugarss: require("sugarss"), 25 // custom parser for custom language 26 custom: require("postcss-custom-syntax"), 27}; 28const syntax = require("postcss-markdown")(options);
PostCSS can be temporarily turned off by using special comments in your Markdown. For example:
<!-- postcss-ignore -->
```css
a {
color: red;
}
```
The main use case of this plugin is to apply linting with Stylelint to CSS (and CSS-like) code blocks in markdown file.
You can use it by configuring your stylelint
config as follows:
1{ 2 "overrides": [ 3 { 4 "files": ["*.md", "**/*.md"], 5 "customSyntax": "postcss-markdown" 6 } 7 ] 8}
Use the stylelint.vscode-stylelint extension that Stylelint provides officially.
You have to configure the stylelint.validate
option of the extension to check .md
files, because the extension does not check the *.md
file by default.
Example .vscode/settings.json:
1{ 2 "stylelint.validate": [ 3 ..., 4 // ↓ Add "markdown" language. 5 "markdown" 6 ]
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
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
Score
Last Scanned on 2024-11-18
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