"title")
//var rgx2 = /\[[ ]*[\s]?[ ]*([^\n\[\]]*?)[ ]*[\s]?[ ]*] ?()\([ ]*[\s]?[ ]*([^\s'"]*)>?(?:[ ]*[\n]?[ ]*()(['"])(.*?)\5)?[ ]*[\s]?[ ]*\)/; // this regex is too slow!!!
var rgx2 = /\[([\S ]*?)]\s?()\( *([^\s'"]*?(?:\([\S]*?\)[\S]*?)?)>?\s*(?:()(['"])(.*?)\5)? *\)/g;
- text = text.replace(rgx2, replaceAnchorTag(rgx2, evtRootName, options, globals));
+ text = text.replace(rgx2, replaceAnchorTagBaseUrl(rgx2, evtRootName, options, globals));
// 4. inline links with titles wrapped in (): [foo](bar.com (title))
var rgx3 = /\[([\S ]*?)]\s?()\( *([^\s'"]*?(?:\([\S]*?\)[\S]*?)?)>?\s+()()\((.*?)\) *\)/g;
- text = text.replace(rgx3, replaceAnchorTag(rgx3, evtRootName, options, globals));
+ text = text.replace(rgx3, replaceAnchorTagBaseUrl(rgx3, evtRootName, options, globals));
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
@@ -222,7 +231,7 @@
text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();
var rgx = /\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g;
- text = text.replace(rgx, replaceAnchorTag(rgx, evtRootName, options, globals));
+ text = text.replace(rgx, replaceAnchorTagReference(rgx, evtRootName, options, globals));
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
@@ -238,7 +247,7 @@
text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();
var rgx = /\[([^\[\]]+)]()()()()()/g;
- text = text.replace(rgx, replaceAnchorTag(rgx, evtRootName, options, globals));
+ text = text.replace(rgx, replaceAnchorTagReference(rgx, evtRootName, options, globals));
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
diff --git a/src/subParsers/makehtml/lists.js b/src/subParsers/makehtml/lists.js
index e22dcd1..1473a9c 100644
--- a/src/subParsers/makehtml/lists.js
+++ b/src/subParsers/makehtml/lists.js
@@ -40,7 +40,7 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
// attacklab: add sentinel to emulate \z
listStr += '¨0';
- var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
+ var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr));
// Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
@@ -48,7 +48,7 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
// activating this option reverts to old behavior
// This will be removed in version 2.0
if (options.disableForced4SpacesIndentedSublists) {
- rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
+ rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
}
listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
diff --git a/src/subParsers/makehtml/stripLinkDefinitions.js b/src/subParsers/makehtml/stripLinkDefinitions.js
index 350da9a..894c8d9 100644
--- a/src/subParsers/makehtml/stripLinkDefinitions.js
+++ b/src/subParsers/makehtml/stripLinkDefinitions.js
@@ -6,18 +6,25 @@
showdown.subParser('makehtml.stripLinkDefinitions', function (text, options, globals) {
'use strict';
- var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,
- base64Regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;
+ var regex = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,
+ base64Regex = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;
// attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
text += '¨0';
var replaceFunc = function (wholeMatch, linkId, url, width, height, blankLines, title) {
+
+ // if there aren't two instances of linkId it must not be a reference link so back out
linkId = linkId.toLowerCase();
+ if (text.toLowerCase().split(linkId).length - 1 < 2) {
+ return wholeMatch;
+ }
if (url.match(/^data:.+?\/.+?;base64,/)) {
// remove newlines
globals.gUrls[linkId] = url.replace(/\s/g, '');
} else {
+ url = showdown.helper.applyBaseUrl(options.relativePathBaseUrl, url);
+
globals.gUrls[linkId] = showdown.subParser('makehtml.encodeAmpsAndAngles')(url, options, globals); // Link IDs are case-insensitive
}
diff --git a/test/functional/makehtml/cases/features/#164.4.tasklists.html b/test/functional/makehtml/cases/features/#164.4.tasklists.html
index cf6ccdf..6a343fa 100644
--- a/test/functional/makehtml/cases/features/#164.4.tasklists.html
+++ b/test/functional/makehtml/cases/features/#164.4.tasklists.html
@@ -1,8 +1,9 @@
my things
otherthings
diff --git a/test/functional/makehtml/cases/features/#164.4.tasklists.md b/test/functional/makehtml/cases/features/#164.4.tasklists.md
index 0054490..047eed3 100644
--- a/test/functional/makehtml/cases/features/#164.4.tasklists.md
+++ b/test/functional/makehtml/cases/features/#164.4.tasklists.md
@@ -4,5 +4,6 @@
- [] bar
- [ ] baz
- [x] bazinga
+ - [X] bazinga 2
otherthings
diff --git a/test/functional/makehtml/cases/features/emojis/simple.html b/test/functional/makehtml/cases/features/emojis/simple.html
index 5ad8c00..2410e44 100644
--- a/test/functional/makehtml/cases/features/emojis/simple.html
+++ b/test/functional/makehtml/cases/features/emojis/simple.html
@@ -1,2 +1,3 @@
🍎 and 💋
💋my🍎
+👩❤️💋👨
diff --git a/test/functional/makehtml/cases/features/emojis/simple.md b/test/functional/makehtml/cases/features/emojis/simple.md
index 76a6c4b..797944d 100644
--- a/test/functional/makehtml/cases/features/emojis/simple.md
+++ b/test/functional/makehtml/cases/features/emojis/simple.md
@@ -1,3 +1,5 @@
:apple: and :kiss:
:kiss:my:apple:
+
+:couplekiss_man_woman:
diff --git a/test/functional/makehtml/cases/features/emojis/special.html b/test/functional/makehtml/cases/features/emojis/special.html
index b591c21..8068ec6 100644
--- a/test/functional/makehtml/cases/features/emojis/special.html
+++ b/test/functional/makehtml/cases/features/emojis/special.html
@@ -1,2 +1,2 @@
this is showdown's emoji
-and this is github's emoji
+and this is github's emoji
diff --git a/test/functional/makehtml/cases/features/relativePathBaseUrl.html b/test/functional/makehtml/cases/features/relativePathBaseUrl.html
new file mode 100644
index 0000000..1c11eec
--- /dev/null
+++ b/test/functional/makehtml/cases/features/relativePathBaseUrl.html
@@ -0,0 +1,9 @@
+inline relative linky
+inline absolute linky
+global relative linky
+global absolute linky
+
+
+
+
+just an anchor
diff --git a/test/functional/makehtml/cases/features/relativePathBaseUrl.md b/test/functional/makehtml/cases/features/relativePathBaseUrl.md
new file mode 100644
index 0000000..f03989e
--- /dev/null
+++ b/test/functional/makehtml/cases/features/relativePathBaseUrl.md
@@ -0,0 +1,22 @@
+[inline relative linky](that_dude_mike.js)
+
+[inline absolute linky](ftp://wikis.com/micky.txt)
+
+[global relative linky][relative_linky]
+
+[global absolute linky][absolute_linky]
+
+![inline relative image](mona-lisa.png)
+
+![inline absolute image](http://images.com/mona-lisa.png)
+
+![global relative image][relative_image]
+
+![global absolute image][absolute_image]
+
+[just an anchor](#holdin_it_down)
+
+[relative_linky]: painters/Michelangelo.html
+[relative_image]: ./mona-lisa.png
+[absolute_linky]: https://www.my-wikis-site.com/peeps/Michelangelo.html
+[absolute_image]: https://www.my-photo-site.com/mona-lisa.png
diff --git a/test/functional/makehtml/cases/issues/#697.space-between-inline-elements.html b/test/functional/makehtml/cases/issues/#697.space-between-inline-elements.html
new file mode 100644
index 0000000..f2e6833
--- /dev/null
+++ b/test/functional/makehtml/cases/issues/#697.space-between-inline-elements.html
@@ -0,0 +1 @@
+one two three
diff --git a/test/functional/makehtml/cases/issues/#697.space-between-inline-elements.md b/test/functional/makehtml/cases/issues/#697.space-between-inline-elements.md
new file mode 100644
index 0000000..878c4dc
--- /dev/null
+++ b/test/functional/makehtml/cases/issues/#697.space-between-inline-elements.md
@@ -0,0 +1 @@
+*one* *two* *three*
diff --git a/test/functional/makehtml/cases/issues/reference-link-impostors.html b/test/functional/makehtml/cases/issues/reference-link-impostors.html
new file mode 100644
index 0000000..706117a
--- /dev/null
+++ b/test/functional/makehtml/cases/issues/reference-link-impostors.html
@@ -0,0 +1,3 @@
+[We] are going to show [you]: sunshine!
+[x]: take out the garbage
+[ ]: bring up the coal
diff --git a/test/functional/makehtml/cases/issues/reference-link-impostors.md b/test/functional/makehtml/cases/issues/reference-link-impostors.md
new file mode 100644
index 0000000..f71ed03
--- /dev/null
+++ b/test/functional/makehtml/cases/issues/reference-link-impostors.md
@@ -0,0 +1,4 @@
+[We] are going to show [you]: sunshine!
+
+[x]: take out the garbage
+[ ]: bring up the coal
diff --git a/test/functional/makehtml/cases/standard/anchors-allow-fragments.html b/test/functional/makehtml/cases/standard/anchors-allow-fragments.html
new file mode 100644
index 0000000..93b9279
--- /dev/null
+++ b/test/functional/makehtml/cases/standard/anchors-allow-fragments.html
@@ -0,0 +1,5 @@
+Declare options
+Declare options
+Declare options
+Common Mark Example
+Common Mark Example
\ No newline at end of file
diff --git a/test/functional/makehtml/cases/standard/anchors-allow-fragments.md b/test/functional/makehtml/cases/standard/anchors-allow-fragments.md
new file mode 100644
index 0000000..9f7525d
--- /dev/null
+++ b/test/functional/makehtml/cases/standard/anchors-allow-fragments.md
@@ -0,0 +1,9 @@
+[Declare options](#Declare)
+
+[Declare options](#Declare%20current%20operation%20options)
+
+[Declare options](<#Declare current operation options>)
+
+[Common Mark Example](https://spec.commonmark.org/0.30/#example-500)
+
+[Common Mark Example](spec.commonmark.org/0.30/#example-500)
\ No newline at end of file
diff --git a/test/functional/makehtml/cases/standard/anchors-allow-javacript-identifiers.html b/test/functional/makehtml/cases/standard/anchors-allow-javacript-identifiers.html
new file mode 100644
index 0000000..8bfd744
--- /dev/null
+++ b/test/functional/makehtml/cases/standard/anchors-allow-javacript-identifiers.html
@@ -0,0 +1,67 @@
+Reserved Keywords found at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar
+break
+case
+catch
+class
+const
+continue
+debugger
+default
+delete
+do
+else
+export
+extends
+finally
+for
+function
+if
+import
+in
+instanceof
+new
+return
+super
+switch
+this
+throw
+try
+typeof
+var
+void
+while
+with
+yield
+enum
+implements
+interface
+let
+package
+private
+protected
+public
+static
+yield
+await
+abstract
+boolean
+byte
+char
+double
+final
+float
+goto
+int
+long
+native
+short
+synchronized
+throws
+transient
+volatile
+null
+true
+false
+arguments
+get
+set
\ No newline at end of file
diff --git a/test/functional/makehtml/cases/standard/anchors-allow-javacript-identifiers.md b/test/functional/makehtml/cases/standard/anchors-allow-javacript-identifiers.md
new file mode 100644
index 0000000..c10e039
--- /dev/null
+++ b/test/functional/makehtml/cases/standard/anchors-allow-javacript-identifiers.md
@@ -0,0 +1,133 @@
+Reserved Keywords found at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar
+
+[break]()
+
+[case]()
+
+[catch]()
+
+[class]()
+
+[const]()
+
+[continue]()
+
+[debugger]()
+
+[default]()
+
+[delete]()
+
+[do]()
+
+[else]()
+
+[export]()
+
+[extends]()
+
+[finally]()
+
+[for]()
+
+[function]()
+
+[if]()
+
+[import]()
+
+[in]()
+
+[instanceof]()
+
+[new]()
+
+[return]()
+
+[super]()
+
+[switch]()
+
+[this]()
+
+[throw]()
+
+[try]()
+
+[typeof]()
+
+[var]()
+
+[void]()
+
+[while]()
+
+[with]()
+
+[yield]()
+
+[enum]()
+
+[implements]()
+
+[interface]()
+
+[let]()
+
+[package]()
+
+[private]()
+
+[protected]()
+
+[public]()
+
+[static]()
+
+[yield]()
+
+[await]()
+
+[abstract]()
+
+[boolean]()
+
+[byte]()
+
+[char]()
+
+[double]()
+
+[final]()
+
+[float]()
+
+[goto]()
+
+[int]()
+
+[long]()
+
+[native]()
+
+[short]()
+
+[synchronized]()
+
+[throws]()
+
+[transient]()
+
+[volatile]()
+
+[null]()
+
+[true]()
+
+[false]()
+
+[arguments]()
+
+[get]()
+
+[set]()
diff --git a/test/functional/makehtml/cases/standard/anchors-allow-no-protocols.html b/test/functional/makehtml/cases/standard/anchors-allow-no-protocols.html
new file mode 100644
index 0000000..771f113
--- /dev/null
+++ b/test/functional/makehtml/cases/standard/anchors-allow-no-protocols.html
@@ -0,0 +1,12 @@
+link
+link
+link
+link
+link
+link
+link
+link
+link
+link
+link
+百度
\ No newline at end of file
diff --git a/test/functional/makehtml/cases/standard/anchors-allow-no-protocols.md b/test/functional/makehtml/cases/standard/anchors-allow-no-protocols.md
new file mode 100644
index 0000000..e99a9a4
--- /dev/null
+++ b/test/functional/makehtml/cases/standard/anchors-allow-no-protocols.md
@@ -0,0 +1,23 @@
+[link](/uri)
+
+[link](http://example.com/)
+
+[link](http://example.com)
+
+[link](https://example.com)
+
+[link](https://example.com/)
+
+[link](example.com)
+
+[link](www.example.com)
+
+[link](file://example.com)
+
+[link](file://www.example.com)
+
+[link](example.jpg)
+
+[link](example.io)
+
+[百度](http://baidu.com "百度")
\ No newline at end of file
diff --git a/test/functional/makehtml/cases/standard/anchors-allow-object-property-names.html b/test/functional/makehtml/cases/standard/anchors-allow-object-property-names.html
new file mode 100644
index 0000000..850fc34
--- /dev/null
+++ b/test/functional/makehtml/cases/standard/anchors-allow-object-property-names.html
@@ -0,0 +1,46 @@
+Object property names found at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
+assign
+create
+defineProperty
+defineProperties
+entries
+freeze
+fromEntries
+getOwnPropertyDescriptor
+getOwnPropertyDescriptors
+getOwnPropertyNames
+getOwnPropertySymbols
+getPrototypeOf
+is
+isExtensible
+isFrozen
+isSealed
+keys
+preventExtensions
+seal
+setPrototypeOf
+values
+prototype.constructor
+prototype.proto
+prototype.defineGetter
+prototype.defineSetter
+prototype.lookupGetter
+prototype.lookupSetter
+prototype.hasOwnProperty
+prototype.isPrototypeOf
+prototype.propertyIsEnumerable
+prototype.toLocaleString
+prototype.toString
+prototype.valueOf
+constructor
+proto
+defineGetter
+defineSetter
+lookupGetter
+lookupSetter
+hasOwnProperty
+isPrototypeOf
+propertyIsEnumerable
+toLocaleString
+toString
+valueOf
diff --git a/test/functional/makehtml/cases/standard/anchors-allow-object-property-names.md b/test/functional/makehtml/cases/standard/anchors-allow-object-property-names.md
new file mode 100644
index 0000000..31a8e04
--- /dev/null
+++ b/test/functional/makehtml/cases/standard/anchors-allow-object-property-names.md
@@ -0,0 +1,91 @@
+Object property names found at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
+
+[assign]()
+
+[create]()
+
+[defineProperty]()
+
+[defineProperties]()
+
+[entries]()
+
+[freeze]()
+
+[fromEntries]()
+
+[getOwnPropertyDescriptor]()
+
+[getOwnPropertyDescriptors]()
+
+[getOwnPropertyNames]()
+
+[getOwnPropertySymbols]()
+
+[getPrototypeOf]()
+
+[is]()
+
+[isExtensible]()
+
+[isFrozen]()
+
+[isSealed]()
+
+[keys]()
+
+[preventExtensions]()
+
+[seal]()
+
+[setPrototypeOf]()
+
+[values]()
+
+[prototype.constructor]()
+
+[prototype.__proto__]()
+
+[prototype.__defineGetter__]()
+
+[prototype.__defineSetter__]()
+
+[prototype.__lookupGetter__]()
+
+[prototype.__lookupSetter__]()
+
+[prototype.hasOwnProperty]()
+
+[prototype.isPrototypeOf]()
+
+[prototype.propertyIsEnumerable]()
+
+[prototype.toLocaleString]()
+
+[prototype.toString]()
+
+[prototype.valueOf]()
+
+[constructor]()
+
+[__proto__]()
+
+[__defineGetter__]()
+
+[__defineSetter__]()
+
+[__lookupGetter__]()
+
+[__lookupSetter__]()
+
+[hasOwnProperty]()
+
+[isPrototypeOf]()
+
+[propertyIsEnumerable]()
+
+[toLocaleString]()
+
+[toString]()
+
+[valueOf]()
diff --git a/test/functional/makehtml/cases/standard/html5-strutural-tags.html b/test/functional/makehtml/cases/standard/html5-strutural-tags.html
index f054d42..2374788 100644
--- a/test/functional/makehtml/cases/standard/html5-strutural-tags.html
+++ b/test/functional/makehtml/cases/standard/html5-strutural-tags.html
@@ -55,3 +55,7 @@
Secondary title
+
+ Summarise me
+ Explain the details
+
diff --git a/test/functional/makehtml/cases/standard/html5-strutural-tags.md b/test/functional/makehtml/cases/standard/html5-strutural-tags.md
index bbf9c67..33ec68d 100644
--- a/test/functional/makehtml/cases/standard/html5-strutural-tags.md
+++ b/test/functional/makehtml/cases/standard/html5-strutural-tags.md
@@ -66,3 +66,8 @@ the end
+
+
+ Summarise me
+ Explain the details
+
diff --git a/test/functional/makehtml/testsuite.features.js b/test/functional/makehtml/testsuite.features.js
index 7510194..cb0caa0 100644
--- a/test/functional/makehtml/testsuite.features.js
+++ b/test/functional/makehtml/testsuite.features.js
@@ -18,7 +18,10 @@ var bootstrap = require('./makehtml.bootstrap.js'),
//literalMidWordAsterisksSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/literalMidWordAsterisks/'),
completeHTMLOutputSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/completeHTMLOutput/'),
metadataSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/metadata/'),
- splitAdjacentBlockquotesSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/splitAdjacentBlockquotes/');
+ splitAdjacentBlockquotesSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/splitAdjacentBlockquotes/'),
+ http = require('http'),
+ https = require('https'),
+ expect = require('chai').expect;
describe('makeHtml() features testsuite', function () {
'use strict';
@@ -96,6 +99,8 @@ describe('makeHtml() features testsuite', function () {
converter = new showdown.Converter({openLinksInNewWindow: true});
} else if (testsuite[i].name === '#355.simplifiedAutoLink-URLs-inside-parenthesis-followed-by-another-character-are-not-parsed-correctly') {
converter = new showdown.Converter({simplifiedAutoLink: true});
+ } else if (testsuite[i].name === 'relativePathBaseUrl') {
+ converter = new showdown.Converter({relativePathBaseUrl: 'http://my.site.com/'});
} else {
converter = new showdown.Converter();
}
@@ -188,7 +193,31 @@ describe('makeHtml() features testsuite', function () {
/** test emojis support **/
describe('emojis support', function () {
var converter,
- suite = emojisSuite;
+ suite = emojisSuite,
+ imgSrcRegexp = /]+src=("https?:\/\/[^"]+"|'https?:\/\/[^']+')/g;
+
+ function testImageUrlExists (imgUrl) {
+ // Strip the quotes
+ imgUrl = imgUrl.substr(0, imgUrl.length - 1).substr(1);
+ return function (done) {
+ (imgUrl.startsWith('http://') ? http : https).get(imgUrl, function (res) {
+ expect(res.statusCode).to.equal(200);
+ // Make sure we get some data and that it's a png
+ expect(parseInt(res.headers['content-length'], 10)).to.be.above(0);
+ expect(res.headers['content-type']).to.equal('image/png');
+
+ // Discard the data (but fetch it)
+ res.on('data', function () {});
+
+ res.on('end', function () {
+ done();
+ });
+ }).on('error', function (e) {
+ throw e;
+ });
+ };
+ }
+
for (var i = 0; i < suite.length; ++i) {
if (suite[i].name === 'simplifiedautolinks') {
converter = new showdown.Converter({emoji: true, simplifiedAutoLink: true});
@@ -197,6 +226,11 @@ describe('makeHtml() features testsuite', function () {
}
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
+
+ var imgUrl = imgSrcRegexp.exec(suite[i].expected);
+ if (imgUrl) {
+ it('should use a working emoji URL', testImageUrlExists(imgUrl[1]));
+ }
}
});
diff --git a/test/functional/makemarkdown/cases/standard/html5-strutural-tags.html b/test/functional/makemarkdown/cases/standard/html5-strutural-tags.html
index 9437a87..6697a02 100644
--- a/test/functional/makemarkdown/cases/standard/html5-strutural-tags.html
+++ b/test/functional/makemarkdown/cases/standard/html5-strutural-tags.html
@@ -32,3 +32,7 @@
Secondary title
+
+ Summarise me
+ Explain the details
+
diff --git a/test/functional/makemarkdown/cases/standard/html5-strutural-tags.md b/test/functional/makemarkdown/cases/standard/html5-strutural-tags.md
index 3c6c7c8..1262a44 100644
--- a/test/functional/makemarkdown/cases/standard/html5-strutural-tags.md
+++ b/test/functional/makemarkdown/cases/standard/html5-strutural-tags.md
@@ -31,3 +31,5 @@ the end
Main title
Secondary title
+
+Summarise me
Explain the details
diff --git a/test/unit/showdown.Converter.js b/test/unit/showdown.Converter.js
index b6ee9ee..0b8c7e0 100644
--- a/test/unit/showdown.Converter.js
+++ b/test/unit/showdown.Converter.js
@@ -122,6 +122,14 @@ describe('showdown.Converter', function () {
converter.getAllExtensions().language.should.contain(extObjMock);
showdown.resetExtensions();
});
+
+ it('removeExtension() should remove an added extension', function () {
+ var converter = new showdown.Converter();
+ converter.addExtension(extObjMock);
+
+ converter.removeExtension(extObjMock);
+ converter.getAllExtensions().language.should.not.contain(extObjMock);
+ });
});
describe('events', function () {