@deskeen/markdown
Advanced tools
Comparing version 5.1.0 to 5.1.1
# Changelog | ||
## 5.1.1 - 2021-05-27 | ||
**🐛 Bugfix** | ||
- Several bold/italic words can be added to a single line. | ||
## 5.1.0 - 2021-05-20 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "@deskeen/markdown", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "Node.js Markdown to HTML Parser", | ||
@@ -5,0 +5,0 @@ "author": "Morgan Schmiedt", |
@@ -519,13 +519,15 @@ 'use strict' | ||
const remainingText = lineText.substring(lineCursor) | ||
const syntaxMatch = /^(\*{1,3})/.exec(remainingText) | ||
const syntax = syntaxMatch[0] | ||
const syntaxSize = syntax.length | ||
const nextChar = remainingText[syntaxSize] | ||
const match = /^(\*{1,3})(.*?\S)(\*{1,3})/ | ||
.exec(remainingText) | ||
if (isSpace(nextChar) === false) { | ||
const endMatch = /(.+?)(?=\S\*)/ | ||
.exec(remainingText.substr(syntaxSize)) | ||
if (match) { | ||
const syntaxOpen = match[1] | ||
const syntaxSize = syntaxOpen.length | ||
const content = match[2] | ||
const syntaxClose = match[3] | ||
const firstContentChar = content[0] | ||
if (endMatch) { | ||
const endTagIndex = endMatch[0].length + syntaxSize + 1 | ||
if (syntaxOpen === syntaxClose | ||
&& isSpace(firstContentChar) === false) { | ||
const endTagIndex = syntaxSize + content.length | ||
@@ -535,3 +537,3 @@ flush() | ||
if (syntax === '*') { | ||
if (syntaxOpen === '*') { | ||
const emNode = document.createElement('EM') | ||
@@ -542,3 +544,3 @@ emNode.ffOnTextEnd = syntaxSize | ||
targetNode = emNode | ||
} else if (syntax === '**') { | ||
} else if (syntaxOpen === '**') { | ||
const strongNode = document.createElement('STRONG') | ||
@@ -563,5 +565,5 @@ strongNode.ffOnTextEnd = syntaxSize | ||
} | ||
ff = syntaxSize | ||
} | ||
ff = syntaxSize | ||
} | ||
@@ -568,0 +570,0 @@ } else if (char === '~') { |
@@ -81,2 +81,10 @@ 'use strict' | ||
test('2 Emphasis on the same line', function (t) { | ||
const input = 'A *1* and a *2*.' | ||
const output = '<p>A <em>1</em> and a <em>2</em>.</p>' | ||
t.equal(parseToHtml(input), output, 'Output is valid') | ||
t.end() | ||
}) | ||
test('Emphasis with wrong end tag inside: space+*', function (t) { | ||
@@ -83,0 +91,0 @@ const input = 'An *italic *tes t* text' |
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
165063
3209