Skip to content
This repository has been archived by the owner on Dec 4, 2017. It is now read-only.

Commit

Permalink
0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Mar 26, 2015
0 parents commit 459c9bb
Show file tree
Hide file tree
Showing 18 changed files with 8,667 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"env": {
"node": true,
"browser": true
},
"rules": {
"quotes": [2, "single"]
}
}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
*.log
bower_components/
build/
components/
coverage/
node_modules/
build.js
143 changes: 143 additions & 0 deletions .jscs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"plugins": [
"jscs-jsdoc"
],
"jsDoc": {
"checkAnnotations": "jsdoc3",
"checkParamNames": true,
"requireParamTypes": true,
"checkRedundantParams": true,
"checkReturnTypes": true,
"checkRedundantReturns": true,
"requireReturnTypes": true,
"checkTypes": "strictNativeCase",
"checkRedundantAccess": true,
"enforceExistence": true,
"requireHyphenBeforeDescription": true
},
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireBlocksOnNewline": true,
"disallowPaddingNewlinesInBlocks": true,
"disallowEmptyBlocks": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"requireSpacesInsideObjectBrackets": "all",
"disallowDanglingUnderscores": true,
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"requireSpaceBeforeBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"disallowSpaceAfterPrefixUnaryOperators": [
"++",
"--",
"+",
"-",
"~",
"!"
],
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"disallowImplicitTypeConversion": [
"numeric",
"boolean",
"binary",
"string"
],
"requireCamelCaseOrUpperCaseIdentifiers": true,
"disallowKeywords": [
"with"
],
"disallowMultipleLineStrings": true,
"disallowMultipleLineBreaks": true,
"validateLineBreaks": "LF",
"validateQuoteMarks": "'",
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"disallowKeywordsOnNewLine": [
"else"
],
"requireLineFeedAtFileEnd": true,
"maximumLineLength": 78,
"requireCapitalizedConstructors": true,
"safeContextKeyword": "self",
"requireDotNotation": true,
"disallowYodaConditions": true,
"validateJSDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
}
}
9 changes: 9 additions & 0 deletions .mdastignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Dependencies.
bower_components/
components/

# Uses different styling, so processed separately.
History.md

# Make sure the fixtures do not get overwritten.
test/
10 changes: 10 additions & 0 deletions .mdastrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"plugins": [
"mdast-github",
"mdast-toc",
"mdast-usage"
],
"settings": {
"bullet": "*"
}
}
15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.*
*.log
bower_components/
build/
components/
coverage/
node_modules/
test/
build.js
example.js
mdast-yaml.js
mdast-yaml.min.js
bower.json
component.json
History.md
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: node_js
script: npm run-script test-travis
node_js:
- '0.10'
- '0.11'
- '0.12'
- iojs
after_script: npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls
sudo: false
deploy:
provider: npm
email: tituswormer@gmail.com
api_key:
secure: ft0F683bsr7L+JcyHpVrM7AoXFSz6XflUh7kqsZWIBvidf7O/x7C8NGugbPhOLUmlZtP+wfsYhr8EkCxw42u7tFC1QgzAnEvIPEPYS5CuahdUKfE8mQrDUrW1MmSbf9MvPAuIRLjLr1a9buAZ0s1gDcYFLH07yL34HJ40bSN9d4=
on:
repo: wooorm/mdast-yaml
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(The MIT License)

Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
116 changes: 116 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# mdast-yaml [![Build Status](https://img.shields.io/travis/wooorm/mdast-yaml.svg?style=flat)](https://travis-ci.org/wooorm/mdast-yaml) [![Coverage Status](https://img.shields.io/coveralls/wooorm/mdast-yaml.svg?style=flat)](https://coveralls.io/r/wooorm/mdast-yaml?branch=master)

Parse and stringify YAML code blocks in **mdast**.

Supports IE9+ ([mdn](https://developer.mozilla.org/JavaScript/Reference/Global_Objects/Object/defineProperty), [Kangax](http://kangax.github.io/compat-table/es5/#Object.defineProperty)).

## Installation

[npm](https://docs.npmjs.com/cli/install)

```bash
$ npm install mdast-yaml
```

[Component.js](https://github.com/componentjs/component)

```bash
$ component install wooorm/mdast-yaml
```

[Bower](http://bower.io/#install-packages)

```bash
$ bower install mdast-yaml
```

[Duo](http://duojs.org/#getting-started)

```javascript
var yaml = require('wooorm/mdast-yaml');
```

UMD: globals, AMD, and CommonJS ([uncompressed](mdast-yaml.js) and [compressed](mdast-yaml.min.js)):

```html
<script src="path/to/mdast.js"></script>
<script src="path/to/mdast-yaml.js"></script>
<script>
mdast.use(mdastYAML);
</script>
```

## Table of Contents

* [Usage](#usage)
* [API](#api)
* [mdast.use(yaml, options)](#mdastuseyaml-options)
* [License](#license)

## Usage

```javascript
var yaml = require('mdast-yaml');
var mdast = require('mdast').use(yaml);
var input = [
'---',
'"layout": "post"',
'"title": \'Blogging Like a Hacker\'',
'---',
'',
'# A header!',
''
].join('\n');
var tree = mdast.parse(input);
```

The `yaml` node now has a `yaml` property.

```javascript
var data = tree.children[0].yaml;
```

```json
{
"layout": "post",
"title": "Blogging Like a Hacker"
}
```

Stringifying the document (note the formatting) yields:

```javascript
var doc = mdast.stringify(tree);
```

```markdown
---
layout: post
title: Blogging Like a Hacker
---

# A header!
```

## API

### [mdast](https://github.com/wooorm/mdast#api).[use](https://github.com/wooorm/mdast#mdastuseplugin-options)(yaml, options)

Adds a `yaml` property to [**YAML**](https://github.com/wooorm/mdast/blob/master/doc/Nodes.md#yaml) nodes.

**Signatures**

* `mdast = mdast.use(yaml, options?)`.

**Parameters**

* `yaml` — This plugin;
* `options` (`Object?`) — Settings:
* `library` (`Object?`, default: [`nodeca/js-yaml`](https://github.com/nodeca/js-yaml));
* `parse` (`string?`, default [`"safeLoad"`](https://github.com/nodeca/js-yaml#safeload-string---options-));
* `stringify` (`string?`, default [`"safeDump"`](https://github.com/nodeca/js-yaml#safedump-object---options-));
* `prettify` (`boolean?`, default: `true`) — When true, the node’s content will be overwritten by the result of `library[stringify](node.yaml)`.

## License

[MIT](LICENSE) © [Titus Wormer](http://wooorm.com)
35 changes: 35 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "mdast-yaml",
"main": "mdast-yaml.js",
"description": "Parse and stringify YAML code blocks in mdast",
"license": "MIT",
"keywords": [
"yaml",
"parse",
"parser",
"serializer",
"mdast"
],
"repository": {
"type": "git",
"url": "https://github.com/wooorm/mdast-yaml.git"
},
"authors": [
"Titus Wormer <tituswormer@gmail.com>"
],
"ignore": [
".*",
"*.log",
"*.md",
"build/",
"components/",
"coverage/",
"node_modules/",
"test/",
"build.js",
"example.js",
"index.js",
"component.json",
"package.json"
]
}
Loading

0 comments on commit 459c9bb

Please sign in to comment.