Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
mdast-util-to-nlcst
Advanced tools
mdast utility to transform markdown into nlcst, while keeping location information intact.
In plain English: this enables natural-language tooling to read markdown as input.
Note You probably want to use remark-retext.
npm:
npm install mdast-util-to-nlcst
mdast-util-to-nlcst is also available for duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.
var toNLCST = require('mdast-util-to-nlcst');
var inspect = require('unist-util-inspect');
var remark = require('remark');
var retext = require('retext');
/*
* Process.
*/
remark().process('Some *foo*s-_ball_.', function (err, file) {
var tree = toNLCST(file, retext().Parser);
console.log(inspect(tree));
/*
* Yields:
*
* RootNode[1] (1:1-1:20, 0-19)
* └─ ParagraphNode[1] (1:1-1:20, 0-19)
* └─ SentenceNode[4] (1:1-1:20, 0-19)
* ├─ WordNode[1] (1:1-1:5, 0-4)
* │ └─ TextNode: "Some" (1:1-1:5, 0-4)
* ├─ WhiteSpaceNode: " " (1:5-1:6, 4-5)
* ├─ WordNode[4] (1:7-1:18, 6-17)
* │ ├─ TextNode: "foo" (1:7-1:10, 6-9)
* │ ├─ TextNode: "s" (1:11-1:12, 10-11)
* │ ├─ PunctuationNode: "-" (1:12-1:13, 11-12)
* │ └─ TextNode: "ball" (1:14-1:18, 13-17)
* └─ PunctuationNode: "." (1:19-1:20, 18-19)
*/
});
toNLCST(file, Parser | parser)
Transform a by remark processed virtual file into an NLCST tree for retext.
Parameters:
file
(File
)
— Virtual file, must be passed through
parse()
.
parser
(Function
or Parser
, optional)
— You can pass the (constructor of) an NLCST parser, such as
parse-english, parse-dutch,
or parse-latin.
Returns:
FAQs
mdast utility to transform to nlcst
The npm package mdast-util-to-nlcst receives a total of 93,186 weekly downloads. As such, mdast-util-to-nlcst popularity was classified as popular.
We found that mdast-util-to-nlcst demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.