Comparing version 1.0.0-beta.3 to 1.0.0-beta.4
@@ -0,2 +1,13 @@ | ||
/** | ||
* @license | ||
* | ||
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) | ||
* https://github.com/chjj/marked | ||
* | ||
* Copyright (c) 2018, Костя Третяк. (MIT Licensed) | ||
* https://github.com/KostyaTretyak/marked-ts | ||
*/ | ||
import { Obj } from './interfaces'; | ||
export declare function merge(obj: Obj, ...args: Obj[]): Obj; | ||
export declare function escape(html: string, encode?: boolean): string; | ||
export declare function unescape(html: string): string; |
@@ -12,2 +12,16 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function merge(obj) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
for (var i = 0; i < args.length; i++) { | ||
var target = args[i]; | ||
for (var key in target) { | ||
obj[key] = target[key]; | ||
} | ||
} | ||
return obj; | ||
} | ||
exports.merge = merge; | ||
var escapeTest = /[&<>"']/; | ||
@@ -14,0 +28,0 @@ var escapeReplace = /[&<>"']/g; |
@@ -22,2 +22,3 @@ "use strict"; | ||
var block_lexer_1 = require("./block-lexer"); | ||
var helpers_1 = require("./helpers"); | ||
var interfaces_1 = require("./interfaces"); | ||
@@ -33,3 +34,3 @@ var Marked = /** @class */ (function () { | ||
Marked.setOptions = function (options) { | ||
this.options = __assign({}, this.options, options); | ||
this.options = helpers_1.merge(this.options, options); | ||
return this; | ||
@@ -36,0 +37,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"author": "Костя Третяк <ktretiak.in.ua@gmail.com>", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.4", | ||
"main": "dist/index", | ||
@@ -37,2 +37,3 @@ "typings": "dist/index", | ||
"@types/node": "^8.5.8", | ||
"commonmark": "^0.28.1", | ||
"concurrently": "^3.5.1", | ||
@@ -39,0 +40,0 @@ "highlight.js": "^9.12.0", |
@@ -44,5 +44,3 @@ [![Build Status](https://travis-ci.org/KostyaTretyak/marked-ts.svg?branch=master)](https://travis-ci.org/KostyaTretyak/marked-ts) | ||
Create instance of `Renderer` only **after** you setting the necessary options. | ||
Do not pass `Renderer` at one time with other options, | ||
because its constructor should also get these options: | ||
Example setting options with default values: | ||
@@ -54,2 +52,3 @@ ```js | ||
({ | ||
renderer: new Renderer, | ||
gfm: true, | ||
@@ -64,4 +63,2 @@ tables: true, | ||
Marked.setOptions({renderer: new Renderer}); | ||
console.log(Marked.parse('I am using __markdown__.')); | ||
@@ -83,3 +80,4 @@ ``` | ||
Marked.setOptions({ highlight: (code, lang) => highlight(lang, code).value }); | ||
console.log(Marked.parse('```js\n console.log("hello"); \n```')); | ||
let md = '```js\n console.log("hello"); \n```'; | ||
console.log(Marked.parse(md)); | ||
``` | ||
@@ -372,5 +370,6 @@ | ||
| ------------------------|--------------|--------------|----------------|-----------|------------------ | ||
| marked-ts v1.0.0-beta.1 | 6 | 6 | 101 | 113 | 8 641 | ||
| marked-ts v1.0.0-beta.4 | 8 | 5 | 99 | 111 | 8 679 | ||
| marked v0.3.12 | 4 | 2 | 106 | 112 | 9 323 | ||
| remarkable v1.7.1 | 36 | 6 | 174 | 216 | 15 356 | ||
| commonmark v0.28.1 | 35 | 3 | 186 | 224 | 24 749 | ||
| markdown-it v8.4.0 | 29 | 10 | 227 | 266 | 18 890 | ||
@@ -377,0 +376,0 @@ | showdown v1.8.6 | 10 | 14 | 353 | 377 | 36 833 |
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
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
76438
1667
16
415