diff --git a/index.js b/index.js
index ed12828..0da057f 100644
--- a/index.js
+++ b/index.js
@@ -147,7 +147,7 @@ const rules = {
},
},
em: Object.assign({}, markdown.defaultRules.em, {
- match: markdown.inlineRegex(/^\b_(\S(?:\\[\s\S]|[^\\])*?\S|\S)_(?!_)/),
+ match: markdown.inlineRegex(/^\b_(\S(?:\\[\s\S]|[^\\])*?\S|\S)_(?!_)\b/),
parse: (capture, parse) => {
return {
content: parse(capture[1]),
diff --git a/package.json b/package.json
index 21c05b3..72ace03 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
"dependencies": {
"escape-html": "^1.0.3",
"node-emoji": "^1.10.0",
- "simple-markdown": "^0.7.2"
+ "simple-markdown": "^0.7.3"
},
"devDependencies": {
"eslint": "^6.8.0",
diff --git a/test/single.test.js b/test/single.test.js
index a46bab1..ef1247a 100644
--- a/test/single.test.js
+++ b/test/single.test.js
@@ -5,11 +5,16 @@ test("Should convert *text* to text", () => {
.toBe("This is a test with some bold text in it");
});
-it("Should convert _text_ to text", () => {
+it("Should convert _text_ to text", () => {
expect(markdown.toHTML("This is a _test_ with _some italicized_ text in it"))
.toBe("This is a test with some italicized text in it");
});
+it("Should not convert inner_underscored_text to innerunderscoredtext", () => {
+ expect(markdown.toHTML("This is a _test_ with some_italicized_text in it"))
+ .toBe("This is a test with some_italicized_text in it");
+});
+
it("Should convert `text` to text
", () => {
expect(markdown.toHTML("Code: `1 + 1 = 2`"))
.toBe("Code: 1 + 1 = 2
");
diff --git a/test/slack.test.js b/test/slack.test.js
index e3058ad..bfd3756 100644
--- a/test/slack.test.js
+++ b/test/slack.test.js
@@ -71,3 +71,8 @@ it("Should disable the extra span tags, if set", () => {
expect(markdown.toHTML("hey <@ID|user>!", { noExtraSpanTags: true }))
.toBe("hey @user!");
});
+
+it("Should handle named links mixed with underscores", () => {
+ expect(markdown.toHTML("Hello _sup "))
+ .toBe("Hello _sup example in_ description");
+});