Comparing version 1.0.0-beta.2 to 1.0.0-beta.3
@@ -340,3 +340,3 @@ "use strict"; | ||
nextPart = nextPart.substring(execArr[0].length); | ||
var type = 'simpleRule' + simpleRules.length; | ||
var type = 'simpleRule' + (i + 1); | ||
this.tokens.push({ type: type, execArr: execArr }); | ||
@@ -350,3 +350,3 @@ continue mainLoop; | ||
nextPart = nextPart.substring(execArr[0].length); | ||
if (execArr[1].charAt(execArr[1].length - 1) === '\n') { | ||
if (execArr[1].slice(-1) === '\n') { | ||
this.tokens.push({ | ||
@@ -359,3 +359,3 @@ type: interfaces_1.TokenType.paragraph, | ||
this.tokens.push({ | ||
type: this.tokens.length > 0 ? interfaces_1.TokenType.paragraph : interfaces_1.TokenType.html, | ||
type: this.tokens.length > 0 ? interfaces_1.TokenType.paragraph : interfaces_1.TokenType.text, | ||
text: execArr[1], | ||
@@ -362,0 +362,0 @@ }); |
@@ -142,2 +142,15 @@ /** | ||
unescape?: (html: string) => string; | ||
/** | ||
* If set to `true`, an inline text will not be taken in paragraph. | ||
* | ||
* ```ts | ||
* // isNoP == false | ||
* Marked.parse('some text'); // returns '<p>some text</p>' | ||
* | ||
* Marked.setOptions({isNoP: true}); | ||
* | ||
* Marked.parse('some text'); // returns 'some text' | ||
* ``` | ||
*/ | ||
isNoP?: boolean; | ||
} | ||
@@ -144,0 +157,0 @@ export interface LexerReturns { |
@@ -73,3 +73,18 @@ "use strict"; | ||
var origin = tokens.slice(); | ||
var result = (new parser_1.Parser(options)).debug(links, tokens); | ||
var parser = new parser_1.Parser(options); | ||
parser.simpleRenderers = this.simpleRenderers; | ||
var result = parser.debug(links, tokens); | ||
/** | ||
* Translates a token type into a readable form, | ||
* and moves `line` field to a first place in a token object. | ||
*/ | ||
origin = origin.map(function (token) { | ||
token.type = interfaces_1.TokenType[token.type] || token.type; | ||
var line = token.line; | ||
delete token.line; | ||
if (line) | ||
return __assign({ line: line }, token); | ||
else | ||
return token; | ||
}); | ||
return { tokens: origin, links: links, result: result }; | ||
@@ -76,0 +91,0 @@ }; |
@@ -78,3 +78,6 @@ "use strict"; | ||
{ | ||
return this.renderer.paragraph(this.parseText()); | ||
if (this.options.isNoP) | ||
return this.parseText(); | ||
else | ||
return this.renderer.paragraph(this.parseText()); | ||
} | ||
@@ -81,0 +84,0 @@ case interfaces_1.TokenType.heading: |
@@ -5,3 +5,3 @@ { | ||
"author": "Костя Третяк <ktretiak.in.ua@gmail.com>", | ||
"version": "1.0.0-beta.2", | ||
"version": "1.0.0-beta.3", | ||
"main": "dist/index", | ||
@@ -33,2 +33,3 @@ "typings": "dist/index", | ||
"@types/highlight.js": "^9.12.2", | ||
"@types/jasmine": "^2.8.4", | ||
"@types/katex": "^0.5.0", | ||
@@ -39,2 +40,3 @@ "@types/markdown-it": "^0.0.4", | ||
"highlight.js": "^9.12.0", | ||
"jasmine": "^2.9.0", | ||
"katex": "^0.9.0-beta", | ||
@@ -49,3 +51,3 @@ "markdown": "*", | ||
"scripts": { | ||
"test": "node dist-test/index.js", | ||
"test": "node dist-test/index.js && ./node_modules/.bin/jasmine", | ||
"compile": "./node_modules/.bin/tsc && ./node_modules/.bin/tsc --project test && ./node_modules/.bin/tsc --project examples-usage", | ||
@@ -52,0 +54,0 @@ "bench": "node --expose-gc dist-test/benchmarks.js", |
@@ -44,3 +44,5 @@ [![Build Status](https://travis-ci.org/KostyaTretyak/marked-ts.svg?branch=master)](https://travis-ci.org/KostyaTretyak/marked-ts) | ||
Example setting options with default values: | ||
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: | ||
@@ -52,3 +54,2 @@ ```js | ||
({ | ||
renderer: new Renderer, | ||
gfm: true, | ||
@@ -63,2 +64,4 @@ tables: true, | ||
Marked.setOptions({renderer: new Renderer}); | ||
console.log(Marked.parse('I am using __markdown__.')); | ||
@@ -65,0 +68,0 @@ ``` |
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
75757
1641
416
15