markdown-to-jsx
Advanced tools
Comparing version 4.1.1-beta to 5.0.0
@@ -1,6 +0,24 @@ | ||
### 4.1.0-beta (January 11, 2017) | ||
### 5.0.0 (January 12, 2017) | ||
The big (hopefully invisible) change in this release is the code exposed when requiring `markdown-to-jsx` is now bundled via rollup in commonjs form and ideally tree-shaken as far as possible. | ||
See the README for updated usage instructions, here's a quick preview: | ||
f435164 Build flat files via rollup | ||
```jsx | ||
import Markdown from 'markdown-to-jsx'; | ||
import React from 'react'; | ||
import {render} from 'react-dom'; | ||
render(( | ||
<Markdown> | ||
# Hello world! | ||
</Markdown> | ||
), document.body); | ||
/* | ||
renders: | ||
<h1>Hello world!</h1> | ||
*/ | ||
``` | ||
38efb41 [Breaking Change] Default export is now a React HOC | ||
573021c Update Jest | ||
@@ -7,0 +25,0 @@ bf31694 chore(package): update autoprefixer-stylus to version 0.13.0 |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "4.1.1-beta", | ||
"version": "5.0.0", | ||
"engines": { | ||
@@ -17,6 +17,8 @@ "node": ">= 4" | ||
], | ||
"author": "Evan Scott <glitterbyte@gmail.com> (http://yaycmyk.com)", | ||
"author": "Evan Jacobs <evan@yaycmyk.com> (http://yaycmyk.com)", | ||
"repository": "yaycmyk/markdown-to-jsx", | ||
"bugs": "https://github.com/yaycmyk/markdown-to-jsx/issues", | ||
"main": "public/markdown-to-jsx.js", | ||
"main": "index.es5.js", | ||
"jsnext:main": "index.js", | ||
"module": "index.js", | ||
"devDependencies": { | ||
@@ -26,20 +28,16 @@ "autoprefixer-stylus": "^0.13.0", | ||
"babel-jest": "^18.0.0", | ||
"babel-plugin-transform-inline-environment-variables": "^6.8.0", | ||
"babel-preset-es2015-rollup": "^3.0.0", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-preset-react": "^6.11.1", | ||
"babel-preset-stage-2": "^6.13.0", | ||
"babelify": "^7.3.0", | ||
"browserify": "^13.1.0", | ||
"budo": "^9.2.0", | ||
"bundle-collapser": "^1.2.1", | ||
"codecov": "^1.0.1", | ||
"jest-cli": "^18.0.0", | ||
"lodash.assign": "^4.2.0", | ||
"mkdirp": "^0.5.1", | ||
"react": "^15.3.1", | ||
"react-dom": "^15.3.1", | ||
"rollup": "^0.41.1", | ||
"rollup-plugin-babel": "^2.7.1", | ||
"rollup-plugin-commonjs": "^7.0.0", | ||
"rollup-plugin-json": "^2.1.0", | ||
"rollup-plugin-node-builtins": "^2.0.0", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"rollup-plugin-uglify": "^1.0.1", | ||
"stylus": "^0.54.5" | ||
"stylus": "^0.54.5", | ||
"uglify-js": "^2.7.3", | ||
"watchify": "^3.7.0" | ||
}, | ||
@@ -55,7 +53,4 @@ "dependencies": { | ||
"babel": { | ||
"plugins": [ | ||
"transform-inline-environment-variables" | ||
], | ||
"presets": [ | ||
"es2015-rollup", | ||
"es2015", | ||
"react", | ||
@@ -66,10 +61,14 @@ "stage-2" | ||
"scripts": { | ||
"prepublish": "npm run build", | ||
"build:master": "NODE_ENV=production node scripts/build-master.js", | ||
"build:site:js": "NODE_ENV=production node scripts/build-site.js", | ||
"build:site:css": "stylus -u autoprefixer-stylus site.styl -o docs/css/style.css -c", | ||
"build:site": "npm run build:site:css && npm run build:site:js", | ||
"build": "npm run build:master && npm run build:site", | ||
"prepublish": "npm run es5", | ||
"es5": "babel index.js --out-file index.es5.js", | ||
"site:css": "stylus -u autoprefixer-stylus site.styl -o docs/css/style.css", | ||
"site:css:release": "npm run site:css -- -c", | ||
"site:css:watch": "npm run site:css -- -w -m -l --sourcemap-inline", | ||
"site:js": "browserify site.js -t babelify -p bundle-collapser/plugin", | ||
"site:js:release": "NODE_ENV=production npm run -s site:js | uglifyjs -mc drop_console --screw-ie8 -o docs/js/bundle.js", | ||
"site:js:watch": "budo site.js:js/bundle.js -d docs -H 0.0.0.0 --colors --live --open --pushstate --iw -- -t babelify", | ||
"site:release": "npm run site:css:release && npm run site:js:release", | ||
"start": "sh scripts/parallelize.sh \"npm run site:css:watch\" \"npm run site:js:watch\"", | ||
"test": "jest --verbose" | ||
} | ||
} |
@@ -19,16 +19,22 @@ # markdown to jsx compiler | ||
The default export function signature: | ||
`markdown-to-jsx` exports a React component by default for easy JSX composition (since version v5): | ||
```js | ||
compiler(markdown: string, options: object?) | ||
``` | ||
ES6-style usage: | ||
```js | ||
import compiler from 'markdown-to-jsx'; | ||
```jsx | ||
import Markdown from 'markdown-to-jsx'; | ||
import React from 'react'; | ||
import {render} from 'react-dom'; | ||
render(compiler('# Hello world!'), document.body); | ||
render(( | ||
<Markdown> | ||
# Hello world! | ||
</Markdown> | ||
), document.body); | ||
/* | ||
renders: | ||
<h1>Hello world!</h1> | ||
*/ | ||
``` | ||
@@ -39,3 +45,3 @@ | ||
```jsx | ||
import compiler from 'markdown-to-jsx'; | ||
import Markdown from 'markdown-to-jsx'; | ||
import React from 'react'; | ||
@@ -47,14 +53,17 @@ import {render} from 'react-dom'; | ||
render( | ||
compiler('# Hello world!', { | ||
overrides: { | ||
h1: { | ||
component: MyParagraph, | ||
props: { | ||
className: 'foo', | ||
render(( | ||
<Markdown | ||
options={{ | ||
overrides: { | ||
h1: { | ||
component: MyParagraph, | ||
props: { | ||
className: 'foo', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}), document.body | ||
); | ||
}}> | ||
# Hello world! | ||
</Markdown> | ||
), document.body); | ||
@@ -81,2 +90,26 @@ /* | ||
## Using the compiler directly | ||
If desired, the compiler function is a "named" export on the `markdown-to-jsx` module: | ||
```jsx | ||
import {compiler} from 'markdown-to-jsx'; | ||
import React from 'react'; | ||
import {render} from 'react-dom'; | ||
render(compiler('# Hello world!'), document.body); | ||
/* | ||
renders: | ||
<h1>Hello world!</h1> | ||
*/ | ||
``` | ||
It accepts the following arguments: | ||
```js | ||
compiler(markdown: string, options: object?) | ||
``` | ||
MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17
1
112
1
32998
5
440