Skip to content

Commit

Permalink
Merge fd6e0dd into e16d0a0
Browse files Browse the repository at this point in the history
  • Loading branch information
greybax committed Feb 12, 2016
2 parents e16d0a0 + fd6e0dd commit 3f8278f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .babelrc
@@ -0,0 +1,5 @@
{
"presets": [
"es2015"
]
}
8 changes: 5 additions & 3 deletions index.js
@@ -1,5 +1,7 @@
import { text, html, matchRemoveList } from 'commonmark-helpers';
import { text, matchRemoveList } from 'commonmark-helpers';
import { is } from 'ramda';
import remark from 'remark';
import html from 'remark-html';

const wrap = item =>
(is(String, item) || is(RegExp, item))
Expand All @@ -11,7 +13,7 @@ export default (input, removeList = []) => {
if (!node) return;
return {
text: text(node),
html: html(node),
html: remark().use(html).process(text(node)),
node
};
};
};
26 changes: 18 additions & 8 deletions package.json
Expand Up @@ -4,14 +4,16 @@
"description": "get content from markdown article",
"main": "index.es5.js",
"scripts": {
"coverage": "isparta cover _mocha index.js -- --require babel/register",
"coverage": "isparta cover _mocha index.js --include-all-sources -- --require babel-core/register",
"precoveralls": "npm run coverage",
"coveralls": "coveralls < coverage/lcov.info",
"test": "mocha --require babel/register",
"test": "mocha --require babel-core/register",
"tdd": "npm test -- --watch",
"transpile": "babel index.js > index.es5.js",
"transpile": "babel index.js --out-file index.es5.js",
"prepublish": "npm run transpile",
"postpublish": "rm *.es5.js && git push --follow-tags"
"clean": "rimraf index.es5.js",
"push": "git push --follow-tags",
"postpublish": "npm-run-all clean push"
},
"repository": {
"type": "git",
Expand All @@ -31,14 +33,22 @@
},
"homepage": "https://github.com/iamstarkov/get-md-content#readme",
"devDependencies": {
"babel": "*",
"coveralls": "*",
"assert": "*",
"babel-cli": "^6.1.18",
"babel-core": "^6.1.21",
"babel-preset-es2015": "^6.1.18",
"coveralls": "*",
"expect": "^1.14.0",
"isparta": "*",
"mocha": "*"
"mocha": "*",
"npm-run-all": "*",
"rimraf": "*",
"should": "^8.2.2"
},
"dependencies": {
"commonmark-helpers": "^0.4.0",
"ramda": "^0.17.1"
"ramda": "^0.19.1",
"remark": "^3.2.3",
"remark-html": "^2.0.2"
}
}
18 changes: 15 additions & 3 deletions test.js
@@ -1,4 +1,5 @@
import { equal } from 'assert';
import expect from 'expect';
import { isHeader } from 'commonmark-helpers';
import getContent from './index';

Expand All @@ -23,13 +24,24 @@ const basic = `
content
with two paragraphs`;
with two paragraphs`

const table = `
|header1|header2|
|-------|-------|
| col1 | col2 |`;

const strikethrough = `
~~text~~`;

it('should getContent combo list', () =>
equal(getContent(basic, [isHeader, /december/gim]).text, 'content\n\nwith two paragraphs'));

it('should getContent empty list', () =>
equal(getContent('content').text, 'content'));

it('should getContent with empty content', () =>
equal(getContent('').text, ''));
it('should getContent with <table> html tag', () =>
expect(getContent(table).html).toInclude('<table>'));

it('should getContent with <del> html tag', () =>
expect(getContent(strikethrough).html).toInclude('<del>'));

0 comments on commit 3f8278f

Please sign in to comment.