Lint-title stuff

This commit is contained in:
Richard Littauer 2016-05-13 15:30:44 -04:00
parent 4c2a4f1211
commit 4ccb64561b
4 changed files with 35 additions and 29 deletions

View File

@ -1,7 +1,13 @@
{ {
"plugins": { "plugins": {
"remark-title": { "remark-title": {},
"title": "IPFS Readme Standard" "lint": {
"no-multiple-toplevel-headings": true,
"list-item-indent": false,
"maximum-line-length": false
} }
},
"settings": {
"commonmark": true
} }
} }

View File

@ -1,4 +1,4 @@
# IPFS Readme Standard # readme-standard
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) [![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
@ -16,9 +16,9 @@ The settings are stored in the `.remarkrc` file. Ideally, this file should be ad
you plan to use `remark`. There are plans to enable a single `.remarkrc` to be used in multiple repos. you plan to use `remark`. There are plans to enable a single `.remarkrc` to be used in multiple repos.
```sh ```sh
$ npm i -g remark > npm i -g remark
$ npm i > npm i
$ remark README.md -o README.md > remark README.md -o README.md
``` ```
## Contribute ## Contribute

View File

@ -1,23 +1,22 @@
var mdast = require('mdast') var mdast = require('remark')
var lint = require('mdast-lint') var lint = require('remark-lint')
var fs = require('graceful-fs') var fs = require('graceful-fs')
var remarkTitle = require('remark-title') var remarkTitle = require('remark-title')
var doc = './README.md' var doc = './README.md'
// TODO Replace README with readme option // TODO Replace README with readme option
// TODO Log that the title has been replaced
fs.writeFileSync(doc, mdast().use(remarkTitle, { // fs.writeFileSync(doc, mdast().use(remarkTitle, {}, lint).process(
title: 'IPFS Readme Standard' // fs.readFileSync(doc, 'utf8'), function (err, file, res) {
}, lint).process( // if (err) {
fs.readFileSync(doc, 'utf8'), function (err, file, res) { // console.log(err)
if (err) { // return
console.log(err) // }
return
}
if (file.messages[0] != null) { // if (file.messages[0] != null) {
console.log(file.messages) // console.log(file.messages)
} else { // } else {
console.log('No errors found!') // console.log('No errors found!')
} // }
}) // })
) // )

View File

@ -25,12 +25,13 @@
}, },
"homepage": "https://github.com/ipfs/ipfs-readme-standard#readme", "homepage": "https://github.com/ipfs/ipfs-readme-standard#readme",
"dependencies": { "dependencies": {
"graceful-fs": "^4.1.2", "graceful-fs": "^4.1.3",
"mdast": "^2.1.0", "mdast-lint": "^2.0.0",
"mdast-lint": "^1.1.1", "remark": "^4.2.1",
"remark-title": "^1.0.0" "remark-lint": "^3.2.0",
"remark-title": "^1.0.3"
}, },
"devDependencies": { "devDependencies": {
"babel-cli": "^6.3.17" "babel-cli": "^6.7.5"
} }
} }