Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mdast-util-to-nlcst

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-to-nlcst - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

11

history.md

@@ -1,9 +0,12 @@

---
mdast:
setext: true
---
<!--mdast setext-->
<!--lint disable no-multiple-toplevel-headings-->
0.2.0 / 2015-08-11
==================
* Refactor API for upcoming unified changes ([c9b2db7](https://github.com/wooorm/mdast-util-to-nlcst/commit/c9b2db7))
* Refactor for changes in mdast ([f5ded15](https://github.com/wooorm/mdast-util-to-nlcst/commit/f5ded15))
0.1.0 / 2015-07-25
==================
/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer. All rights reserved.
* @copyright 2015 Titus Wormer
* @license MIT
* @module mdast:util:to-nlcst

@@ -215,3 +216,2 @@ * @fileoverview Create a Natural Language Concrete Syntax Tree from

*
* @param {MDASTNode} ast - Node.
* @param {File} file - Virtual file.

@@ -222,4 +222,6 @@ * @param {Function?} [Parser] - Constructor of an nlcst

*/
function toNLCST(ast, file, Parser) {
function toNLCST(file, Parser) {
var ast;
var parser;
var cst;

@@ -230,2 +232,8 @@ /*

if (!file || !file.messages) {
throw new Error('mdast-util-to-nlcst expected file');
}
ast = file.namespace('mdast').ast;
if (!ast || !ast.type) {

@@ -235,6 +243,2 @@ throw new Error('mdast-util-to-nlcst expected node');

if (!file || !file.messages) {
throw new Error('mdast-util-to-nlcst expected file');
}
if (

@@ -267,12 +271,6 @@ !ast.position ||

/*
* Patch ranges when not given.
* Patch ranges.
*/
if (
!ast.position ||
!ast.position.start ||
isNaN(ast.position.start.offset)
) {
range()(ast, file);
}
range()(ast, file);

@@ -285,3 +283,7 @@ /*

return parser.parse(one(ast, null, null, file, parser));
cst = parser.parse(one(ast, null, null, file, parser));
file.namespace('retext').cst = cst;
return cst;
}

@@ -288,0 +290,0 @@

{
"name": "mdast-util-to-nlcst",
"version": "0.1.0",
"version": "0.2.0",
"description": "Markdown to Natural Language",

@@ -15,4 +15,4 @@ "license": "MIT",

"mdast-range": "^0.4.3",
"mdast-util-visit": "^0.1.1",
"parse-latin": "^0.5.1"
"parse-latin": "^0.5.1",
"unist-util-visit": "^1.0.0"
},

@@ -33,15 +33,18 @@ "repository": {

"browserify": "^11.0.0",
"eslint": "^0.24.0",
"eslint": "^1.1.0",
"esmangle": "^1.0.0",
"istanbul": "^0.3.0",
"jscs": "^1.0.0",
"jscs": "^2.0.0",
"jscs-jsdoc": "^1.0.0",
"mdast": "^0.27.0",
"mdast": "^0.29.0",
"mdast-comment-config": "^0.1.2",
"mdast-github": "^0.3.0",
"mdast-lint": "^0.4.0",
"mdast-yaml-config": "^0.2.0",
"mdast-slug": "^0.1.1",
"mdast-validate-links": "^0.3.1",
"mocha": "^2.0.0",
"nlcst-to-string": "^0.1.5",
"parse-dutch": "^0.5.0",
"parse-english": "^0.5.0"
"parse-english": "^0.5.0",
"vfile": "^1.0.0"
},

@@ -60,5 +63,5 @@ "scripts": {

"postbundle": "esmangle mdast-util-to-nlcst.js > mdast-util-to-nlcst.min.js",
"build-md": "mdast . --output --quiet",
"build-md": "mdast . --quiet",
"build": "npm run bundle && npm run build-md"
}
}

@@ -1,2 +0,2 @@

# mdast-util-to-nlcst [![Build Status](https://img.shields.io/travis/wooorm/mdast-util-to-nlcst.svg?style=flat)](https://travis-ci.org/wooorm/mdast-util-to-nlcst) [![Coverage Status](https://img.shields.io/coveralls/wooorm/mdast-util-to-nlcst.svg?style=flat)](https://coveralls.io/r/wooorm/mdast-util-to-nlcst?branch=master)
# mdast-util-to-nlcst [![Build Status](https://img.shields.io/travis/wooorm/mdast-util-to-nlcst.svg)](https://travis-ci.org/wooorm/mdast-util-to-nlcst) [![Coverage Status](https://img.shields.io/codecov/c/github/wooorm/mdast-util-to-nlcst.svg)](https://codecov.io/github/wooorm/mdast-util-to-nlcst)

@@ -10,2 +10,6 @@ [**mdast**](https://github.com/wooorm/mdast) utility to transform markdown

> **Note** The interface is pretty rough. But in the future this will be built
> into mdast/retext, something called “bridging”, so you won’t have to
> use this library manually in the future :smile:!
## Installation

@@ -40,3 +44,4 @@

mdast.process('Some *foo*s-_ball_.', function (err, doc, file) {
var nlcst = toNLCST(file.ast, file);
toNLCST(file);
console.log(file.namespace('retext').cst);
/*

@@ -195,17 +200,16 @@ * Yields:

### toNLCST(ast, file\[, Parser | parser\])
### toNLCST(file\[, Parser | parser\])
Transform `ast` (the [**mdast**](https://github.com/wooorm/mdast) tree relating
to `file`) into an [**nlcst**](https://github.com/wooorm/nlcst) node.
Transform a by [**mdast**](https://github.com/wooorm/mdast) processed
[**virtual file**](https://github.com/wooorm/vfile) into an file ready
for processing by [**retext**](https://github.com/wooorm/retext).
Parameters:
* `ast` (`Node`)
— [**mdast** node](https://github.com/wooorm/mdast/blob/master/doc/nodes.md);
* `file` (`File`)
— [Virtual file](https://github.com/wooorm/mdast/blob/master/doc/mdast.3.md#file).
— [Virtual file](https://github.com/wooorm/vfile), must be passed through
[`parse()`](https://github.com/wooorm/mdast/blob/master/doc/mdast.3.md#mdastparsefile-options).
* `parser` (`Function` or `Parser`, default: `new ParseLatin()`, optional)
— You can pass the (constructor of) an nlcst parser, such as
— You can pass the (constructor of) an NLCST parser, such as
[**parse-english**](https://github.com/wooorm/parse-english) or

@@ -212,0 +216,0 @@ [**parse-dutch**](https://github.com/wooorm/parse-dutch), the default is

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc