remarkable
Advanced tools
Comparing version 1.7.4 to 2.0.0
#!/usr/bin/env node | ||
/*eslint no-console:0*/ | ||
'use strict'; | ||
var fs = require('fs'); | ||
var argparse = require('argparse'); | ||
var Remarkable = require('..'); | ||
//////////////////////////////////////////////////////////////////////////////// | ||
var cli = new argparse.ArgumentParser({ | ||
prog: 'remarkable', | ||
version: require('../package.json').version, | ||
addHelp: true | ||
}); | ||
cli.addArgument([ 'file' ], { | ||
help: 'File to read', | ||
nargs: '?', | ||
defaultValue: '-' | ||
}); | ||
var options = cli.parseArgs(); | ||
function readFile(filename, encoding, callback) { | ||
if (options.file === '-') { | ||
var chunks = []; | ||
// read from stdin | ||
process.stdin.on('data', function(chunk) { | ||
chunks.push(chunk); | ||
}); | ||
process.stdin.on('end', function() { | ||
return callback(null, Buffer.concat(chunks).toString(encoding)); | ||
}); | ||
} else { | ||
fs.readFile(filename, encoding, callback); | ||
} | ||
} | ||
//////////////////////////////////////////////////////////////////////////////// | ||
readFile(options.file, 'utf8', function (err, input) { | ||
var output, md; | ||
if (err) { | ||
if (err.code === 'ENOENT') { | ||
console.error('File not found: ' + options.file); | ||
process.exit(2); | ||
} | ||
console.error(err.stack || err.message || String(err)); | ||
process.exit(1); | ||
} | ||
md = new Remarkable('full', { | ||
html: true, | ||
xhtmlOut: true, | ||
typographer: true, | ||
linkify: true | ||
}); | ||
try { | ||
output = md.render(input); | ||
} catch (e) { | ||
console.error(e.stack || e.message || String(e)); | ||
process.exit(1); | ||
} | ||
process.stdout.write(output); | ||
process.exit(0); | ||
}); | ||
require('../dist/cjs/cli.js'); |
@@ -0,1 +1,18 @@ | ||
2.0.0 / 2019-08-07 | ||
- bundle umd with rollup (#346) | ||
- remove bower support (#347) | ||
- decouple linkify in separate plugin (#351) | ||
- convert code to esm and distribute as cjs and esm bundles (#352) | ||
- upgrade autolinker (#356) | ||
- provide smaller browser version of entities (#359) | ||
- use named exports for public api (#354) | ||
1.7.4 / 2019-07-30 | ||
------------------ | ||
- upgrade argparse (https://github.com/jonschlinkert/remarkable/pull/349) | ||
- prevent a ReDoS vulnerability (#335) | ||
- disallow ascii control characters in URLs (#334) | ||
1.7.0 / 2016-09-27 | ||
@@ -2,0 +19,0 @@ ------------------ |
{ | ||
"name": "remarkable", | ||
"description": "Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in one.", | ||
"version": "1.7.4", | ||
"version": "2.0.0", | ||
"homepage": "https://github.com/jonschlinkert/remarkable", | ||
"maintainers": [ | ||
"doowb <brian.woodward@sellside.com>", | ||
"jonschlinkert <github@sellside.com>" | ||
"jonschlinkert <github@sellside.com>", | ||
"Bogdan Chadkin <trysound@yandex.ru>" | ||
], | ||
@@ -41,3 +42,3 @@ "contributors": [ | ||
], | ||
"repository": "jonschlinkert/remarkable", | ||
"repository": "https://github.com/jonschlinkert/remarkable", | ||
"bugs": { | ||
@@ -49,21 +50,35 @@ "url": "https://github.com/jonschlinkert/remarkable/issues" | ||
"bin", | ||
"linkify", | ||
"dist", | ||
"index.js", | ||
"lib" | ||
"index.js" | ||
], | ||
"main": "index.js", | ||
"bin": "./bin/remarkable.js", | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.js", | ||
"browser": { | ||
"./dist/cjs/index.js": "./dist/cjs/index.browser.js", | ||
"./dist/esm/index.js": "./dist/esm/index.browser.js" | ||
}, | ||
"engines": { | ||
"node": ">= 0.10.0" | ||
"node": ">= 6.0.0" | ||
}, | ||
"scripts": { | ||
"test": "make test", | ||
"test-ci": "nyc mocha -R spec --bail", | ||
"build": "rm -rf dist && yarn rollup -c", | ||
"lint": "eslint .", | ||
"test:browser": "yarn build && node -r esm ./test/test-browser.js && serve .", | ||
"test:spec": "./support/specsplit.js test/fixtures/commonmark/spec.txt", | ||
"test:mocha": "mocha -r esm -R spec", | ||
"test:ci": "nyc mocha -r esm -R spec --bail", | ||
"test": "yarn test:mocha && yarn test:spec", | ||
"coverage": "yarn add coveralls@2 && nyc report --reporter=text-lcov | coveralls", | ||
"build": "make browserify", | ||
"prepublishOnly": "make browserify" | ||
"prepublishOnly": "yarn build" | ||
}, | ||
"nyc": { | ||
"exclude": [ | ||
"dist" | ||
] | ||
}, | ||
"dependencies": { | ||
"argparse": "^1.0.10", | ||
"autolinker": "~0.28.0" | ||
"autolinker": "^3.11.0" | ||
}, | ||
@@ -73,4 +88,6 @@ "devDependencies": { | ||
"benchmark": "^1.0.0", | ||
"browserify": "^16.3.0", | ||
"commonmark": "0.12.0", | ||
"eslint": "^6.1.0", | ||
"eslint-plugin-es5": "^1.4.1", | ||
"esm": "^3.2.25", | ||
"gulp-format-md": "^0.1.10", | ||
@@ -80,3 +97,8 @@ "highlight.js": "^9.7.0", | ||
"mocha": "^6.1.4", | ||
"nyc": "^14.1.1" | ||
"nyc": "^14.1.1", | ||
"rollup": "^1.16.7", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-terser": "^5.1.1", | ||
"serve": "^11.1.0" | ||
}, | ||
@@ -83,0 +105,0 @@ "keywords": [ |
@@ -27,8 +27,2 @@ # remarkable | ||
**bower:** | ||
```bash | ||
bower install remarkable --save | ||
``` | ||
**browser (CDN):** | ||
@@ -43,3 +37,3 @@ | ||
```js | ||
var Remarkable = require('remarkable'); | ||
import { Remarkable } from 'remarkable'; | ||
var md = new Remarkable(); | ||
@@ -51,2 +45,13 @@ | ||
or with commonjs | ||
```js | ||
const { Remarkable } = require('remarkable'); | ||
var md = new Remarkable(); | ||
console.log(md.render('# Remarkable rulezz!')); | ||
// => <h1>Remarkable rulezz!</h1> | ||
``` | ||
If installed globally with `npm`: | ||
@@ -91,3 +96,2 @@ | ||
langPrefix: 'language-', // CSS language prefix for fenced blocks | ||
linkify: false, // Autoconvert URL-like text to links | ||
@@ -115,3 +119,4 @@ // Enable some language-neutral replacement + quotes beautification | ||
```js | ||
var Remarkable = require('remarkable'); | ||
import { Remarkable } from 'remarkable'; | ||
var md = new Remarkable(); | ||
@@ -141,3 +146,3 @@ | ||
```js | ||
var Remarkable = require('remarkable'); | ||
import { Remarkable } from 'remarkable'; | ||
var md = new Remarkable('commonmark'); | ||
@@ -151,3 +156,3 @@ ``` | ||
```js | ||
var Remarkable = require('remarkable'); | ||
import { Remarkable } from 'remarkable'; | ||
var md = new Remarkable('full'); | ||
@@ -158,3 +163,2 @@ | ||
html: true, | ||
linkify: true, | ||
typographer: true | ||
@@ -170,4 +174,4 @@ }); | ||
```js | ||
var Remarkable = require('remarkable'); | ||
var hljs = require('highlight.js') // https://highlightjs.org/ | ||
import { Remarkable } from 'remarkable'; | ||
import hljs from 'highlight.js' // https://highlightjs.org/ | ||
@@ -223,3 +227,2 @@ // Actual default values | ||
html: true, | ||
linkify: true, | ||
typographer: true, | ||
@@ -255,3 +258,3 @@ }); | ||
```js | ||
var Remarkable = require('remarkable'); | ||
import { Remarkable } from 'remarkable'; | ||
var md = new Remarkable({ | ||
@@ -299,2 +302,22 @@ typographer: true, | ||
### linkify plugin | ||
Autoconvert URL-like text to links | ||
```js | ||
import { Remarkable } from 'remarkable'; | ||
import { linkify } from 'remarkable/linkify'; | ||
var md = new Remarkable().use(linkify); | ||
``` | ||
### UMD | ||
UMD bundle provides linkify out of the box | ||
```js | ||
const { Remarkable, linkify, utils } = window.remarkable; | ||
``` | ||
## References / Thanks | ||
@@ -301,0 +324,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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 repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
1135821
32792
0
373
2
16
15
1
+ Addedautolinker@3.16.2(transitive)
+ Addedtslib@2.8.1(transitive)
- Removedautolinker@0.28.1(transitive)
- Removedconcat-with-sourcemaps@1.1.0(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedgulp-header@1.8.12(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedlodash._reinterpolate@3.0.0(transitive)
- Removedlodash.template@4.5.0(transitive)
- Removedlodash.templatesettings@4.2.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)
Updatedautolinker@^3.11.0