Skip to content
Commits on Source (6)
test*
*~
yarn*
.gitlab-ci.yml
.tickings
.eslintrc.json
utils
README.src.md
CHANGELOG.md
/yarn*
/.gitlab-ci.yml
/.tickings
/.eslintrc.json
/util
/README.src.md
/.lintstagedrc.js
......@@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
## [1.4.2] - 2020-08-02
### Added
- Added `voidTags` (an array of HTML element tags that don't have a closing
tag)
### Fixed
- Fix example around highlighter
## [1.4.1] - 2020-06-14
### Fixed
......
......@@ -69,7 +69,9 @@ var superTag = (attributes) => {
return `You are super '${attributes.name}' because ${attributes.arguments.join(',')}`
};
// var highlighter = (code, language) => {
// Use a code highlighter to highlight code in ``` tags. The function should
// return an element as created by the used createElement function
// var highlight = (code, language) => {
// return React.createElement(SyntaxHighlighter, {
// showLineNumbers: true,
// style: defaultStyle,
......@@ -103,7 +105,7 @@ var elements = twitchdown(markdown, {
// Function to use for creating elements
// createElement: React.createElement,
// Highlighter function for code blocks
//highlighter: highlighter,
//highlight: highlight,
// These HTML tags and their contents will be completely removed (defaults to <script> tags)
removeTags: [ 'script' ],
// These HTML tags will be removed, but their contents will be kept
......@@ -150,6 +152,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
## [1.4.2] - 2020-08-02
### Added
- Added `voidTags` (an array of HTML element tags that don't have a closing
tag)
### Fixed
- Fix example around highlighter
## [1.4.1] - 2020-06-14
### Fixed
......
......@@ -13,7 +13,9 @@ var superTag = (attributes) => {
return `You are super '${attributes.name}' because ${attributes.arguments.join(',')}`
};
// var highlighter = (code, language) => {
// Use a code highlighter to highlight code in ``` tags. The function should
// return an element as created by the used createElement function
// var highlight = (code, language) => {
// return React.createElement(SyntaxHighlighter, {
// showLineNumbers: true,
// style: defaultStyle,
......@@ -47,7 +49,7 @@ var elements = twitchdown(markdown, {
// Function to use for creating elements
// createElement: React.createElement,
// Highlighter function for code blocks
//highlighter: highlighter,
//highlight: highlight,
// These HTML tags and their contents will be completely removed (defaults to <script> tags)
removeTags: [ 'script' ],
// These HTML tags will be removed, but their contents will be kept
......
......@@ -583,4 +583,6 @@ module.exports = function parse(md, options) {
flushTo();
return out;
}
};
module.exports.voidTags = voidTags;
"use strict";var voidTags=["area","base","br","col","embed","hr","img","input","link","menuitem","meta","param","source","track","wbr"];module.exports=function parse(md,options){var TAGS={"":[null,"em"],_:[null,"strong"],"~":[null,"s"],"\n":["br",null]," ":["br",null],"-":["hr",null]};function outdent(str){return str.replace(RegExp("^"+(str.match(/^(\t| )+/)||"")[0],"gm"),"")}function encodeAttr(str){return(str+"").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function addParagraph(){tags.push({tag:"p",attributes:{key:key++},out:out});out=[]}function tag(tagToken){var desc=TAGS[tagToken.replace(/\*/g,"_")[1]||""];addPrev();if(desc[1]&&tags.length&&tags[tags.length-1].tag===desc[1]&&tags[tags.length-1].tagToken===tagToken){var currentTag=tags.pop();currentTag.out.push(e(currentTag.tag,{key:key++},out));out=currentTag.out;lastIsBlock=false}else{if(desc[0]){if(options.paragraphs){flushTo("p")}if(options.paragraphs&&desc[0]==="br"&&(!tags.length||tags[tags.length-1].tag==="p")){}else{out.push(e(desc[0],{key:key++}))}}if(desc[1]){if(options.paragraphs&&!tags.length){addParagraph()}tags.push({tag:desc[1],attributes:{key:key++},tagToken:tagToken,out:out});out=[];lastIsBlock=false}}}function flushTo(tagType,justAbove){var target=0;if(!tags.length){return}if(tagType){for(target=tags.length-1;target>=0;target--){if(tags[target].tag===tagType){break}}if(justAbove){target++}if(target<0||target>=tags.length){return tags.length}}var i;for(i=tags.length-1;i>=target;i--){if(options.removeTags.indexOf(tags[i].tag.toLowerCase())!==-1){chunk=null}else{if(prev){out.push(prev)}if(options.stripTags.indexOf(tags[i].tag.toLowerCase())!==-1){chunk=null;tags[i].out=tags[i].out.concat(out)}else{tags[i].out.push(e(tags[i].tag,tags[i].attributes||null,out))}}prev=null;chunk=null;out=tags[i].out}chunk=null;if(target){tags=tags.slice(0,target)}else{tags=[]}return tags.length}function clean(string,trimPrev){var cleaned=string.replace(/\n/g," ").replace(/\s+/," ");if(lastIsBlock&&trimPrev){cleaned=cleaned.trim()}else if(trimPrev){cleaned=cleaned.replace(/[\s\uFEFF\xA0]+$/g,"")}else if(lastIsBlock){cleaned=cleaned.replace(/^[\s\uFEFF\xA0]+/g,"")}lastIsBlock=false;return cleaned}function addPrev(trimPrev){if(prev){prev=clean(prev,trimPrev);if(prev){if(options.paragraphs&&!tags.length){addParagraph()}out.push(clean(prev))}prev=""}}function iderize(text){return text.replace(/(?:!\[[^\]]*?\]\([^)]+?)\)/,"").replace(/\[(.*)\](?:\([^)]+?\))?/g,"$1").toLowerCase().replace(/[^\s-_a-z0-9]/g,"").trim().replace(/\s+/g,"-").replace(/-{2,}/g,"-")}function splitAttributes(attributes,parseArguments){if(typeof parseArguments==="undefined"){parseArguments=options.parseArguments}var attributeTokenizer=/\s+((?:([-_a-zA-Z0-9]+)=)?(?:"((?:\\"|[^"])*)"|([^"\s}]+)))/g,split=parseArguments?{arguments:[]}:[],attribute,value;while(attribute=attributeTokenizer.exec(attributes)){if(parseArguments){value=attribute[3]&&attribute[3].replace(/\\"/g,'"')||attribute[4];if(attribute[2]){split[attribute[2]]=value}else{split.arguments.push(value)}}else{if(attribute[2]){split.push(attribute[1])}else{split.push(attribute[3]&&attribute[3].replace(/\\"/g,'"')||attribute[4])}}}if(parseArguments||split.length){return split}}if(!options){options={}}if(!options.removeTags){options.removeTags=["script"]}if(!options.stripTags){options.stripTags=[]}var e;if(!options.createElement){e=function(type,props,children){var element={type:type,props:props};if(children){element.children=children}return element}}else{e=options.createElement}var tokenizer=new RegExp("((?:^|\\n+)(?:\\n---+|\\* \\*(?: \\*)+)\\n)|"+"(?:^``` *(\\w*)\\n([\\s\\S]*?)\\n```$)|"+"((?:(?:^|\\n+)(?:\\t| {2,}).+)+\\n*)|"+"((?:(?:^|\\n)([>*+-]|\\d+\\.)\\s+.*(?:\\n[ \\t]+.*)*)+)|"+"(?:!\\[([^\\]]*?)\\]\\(([^)]+?)\\))|"+"(\\[)|(\\](?:\\(([^)]+?)\\))?)|"+"(?:(?:^|\\n+)([^\\s].*)\\n(-{3,}|={3,})(?:\\n+|$))|"+"(?:(?:^|\\n+)(#{1,6})\\s*(.+)(?:\\n+|$))|"+"(?:`([^`].*?)`)|"+"( {2}\\n\\n*|\\n{2,}|__|\\*\\*|[_*]|~~)|"+'(?:{@(\\w+)((?:\\s+(?:[-_a-zA-Z0-9]+=)?(?:"(?:\\\\"|[^"])*"|[^"\\s}]*))*)})|'+"(?:<\\s*(\\/?)(\\w+)( [^>]+?)?\\s*\\/?>)","gm"),out=[],links=options.referenceLinks||{},last=0,tags=[],key=0,i,j,lastIsBlock=false,chunk,prev,token,t,customTagerizer=/{@(\w+)((?:\s+(?:"(?:\\"|[^"])*"|[^"\s}]*))*)}/;md=md.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(s,name,url){links[name.toLowerCase()]=url.replace(customTagerizer,function(u,customTag,attributes){if(options.customTags&&options.customTags[customTag]){return options.customTags[customTag](splitAttributes(attributes))}else{return""}});return""}).replace(/^\n+|\n+$/g,"");while(token=tokenizer.exec(md)){prev=md.substring(last,token.index);last=tokenizer.lastIndex;chunk=token[0];if(prev.match(/[^\\](\\\\)*\\$/)){}else if(token[3]){if(options.paragraphs){addPrev(true);flushTo("p")}if(options.highlight){chunk=options.highlight(token[3],token[2])}else{chunk=e("pre",{key:key++,className:"code"+(token[2]&&" "+token[2].toLowerCase())},[outdent(encodeAttr(token[3]).replace(/^\n+|\n+$/g,""))]);lastIsBlock=true}}else if(token[4]){if(options.paragraphs){addPrev(true);flushTo("p")}chunk=e("pre",{key:key++,className:"code poetry"},[outdent(encodeAttr(token[4]).replace(/^\n+|\n+$/g,""))]);lastIsBlock=true}else if(token[6]){t=token[6];if(t.match(/\./)){token[5]=token[5].replace(/^\d+/gm,"")}if(options.paragraphs){addPrev(true);flushTo("p")}var parseOptions=Object.assign({},options,{referenceLinks:links,paragraphs:false});if(t===">"){chunk=e("blockquote",{key:key++},parse(outdent(token[5].replace(/^>\s*/gm,"")),parseOptions));lastIsBlock=true}else{t=t.match(/^\d+\./)?"ol":"ul";var items=token[5].split(/^[*+-.]\s/gm);var eItems=[];items.shift();for(i=0;i<items.length;i++){var lines=items[i].split("\n");if(lines.length>1){var spacing=lines[1].match(/^[ \t]+/);if(spacing){spacing=new RegExp("^"+spacing[0]);for(j=1;j<lines.length;j++){lines[j]=lines[j].replace(spacing,"")}items[i]=lines.join("\n")}}eItems.push(e("li",{key:key++},parse(items[i],parseOptions)))}chunk=e(t,{key:key++},eItems);lastIsBlock=true}}else if(token[8]){addPrev();if(options.paragraphs&&!tags.length){addParagraph()}token[8]=token[8].replace(customTagerizer,function(s,customTag,attributes){if(options.customTags&&options.customTags[customTag]){return options.customTags[customTag](splitAttributes(attributes))}else{return""}});var props;if(token[7]){props={key:key++,src:encodeAttr(token[8]),alt:encodeAttr(token[7]),title:encodeAttr(token[7])}}else{props={key:key++,src:encodeAttr(token[8])}}chunk=e("img",props)}else if(token[10]){flushTo("a",true);if(tags.length){if(token[11]){token[11]=token[11].replace(customTagerizer,function(s,customTag,attributes){if(options.customTags&&options.customTags[customTag]){return options.customTags[customTag](splitAttributes(attributes))}else{return""}})}var href=token[11]||links[prev.toLowerCase().trim()];if(href){tags[tags.length-1].attributes.href=encodeAttr(href);if(options.openExternalInNewWindow&&tags[tags.length-1].attributes.href.match(/^https?:\/\//)){tags[tags.length-1].attributes.target="_blank"}}}flushTo("a");lastIsBlock=false}else if(token[9]){addPrev();if(options.paragraphs&&!tags.length){addParagraph()}tags.push({index:token.index,tag:"a",attributes:{key:key++},out:out});out=[];chunk=""}else if(token[12]||token[14]){t="h"+(token[14]?token[14].length:token[13][0]==="="?1:2);if(options.paragraphs){addPrev(true);flushTo("p")}chunk=e(t,options.headingIds?{key:key++,id:iderize(token[12]||token[15])}:{key:key++},parse(token[12]||token[15],Object.assign({},options,{referenceLinks:links,paragraphs:false})));lastIsBlock=true}else if(token[16]){addPrev();if(options.paragraphs&&!tags.length){addParagraph()}chunk=e("code",{key:key++},[encodeAttr(token[16])]);lastIsBlock=false}else if(token[17]||token[1]){tag(token[17]||"--");chunk=null}else if(token[18]){if(options.customTags&&options.customTags[token[18]]){var inParagraph=typeof options.customTags[token[18]]==="object"&&typeof options.customTags[token[18]]!=="undefined"?options.customTags[token[18]].inParagraph:options.tagsInParagraph;var parseArguments=typeof options.customTags[token[18]]==="object"&&typeof options.customTags[token[18]]!=="undefined"?options.customTags[token[18]].parseArguments:options.parseArguments;addPrev(!inParagraph);if(options.paragraphs){if(inParagraph){if(!tags.length){addParagraph()}}else{flushTo("p")}}if(typeof options.customTags[token[18]]==="function"){chunk=options.customTags[token[18]](splitAttributes(token[19],parseArguments))}else if(typeof options.customTags[token[18]].handler==="function"){chunk=options.customTags[token[18]].handler(splitAttributes(token[19],parseArguments))}else{chunk=null}lastIsBlock=!inParagraph}else{chunk=null}}else if(token[21]){chunk="";if(token[20]){if(tags.length){flushTo(token[21])}}else{addPrev(token[21]==="p");if(token[21]==="p"&&options.paragraphs){flushTo("p")}if(token[22]){token[22]=splitAttributes(token[22],true);if(token[22].arguments.length){for(i=0;i<token[22].arguments.length;i++){token[22][token[22].arguments[i]]=true}}delete token[22].arguments;token[22].key=key++}else{token[22]={key:key++}}if(voidTags.indexOf(token[21])!==-1){out.push(e(token[21],token[22]))}else{tags.push({index:token.index,tag:token[21],attributes:token[22],out:out});out=[]}prev=""}}addPrev();if(chunk){out.push(chunk)}}prev=md.substring(last);addPrev();flushTo();return out};
"use strict";var voidTags=["area","base","br","col","embed","hr","img","input","link","menuitem","meta","param","source","track","wbr"];module.exports=function parse(md,options){var TAGS={"":[null,"em"],_:[null,"strong"],"~":[null,"s"],"\n":["br",null]," ":["br",null],"-":["hr",null]};function outdent(str){return str.replace(RegExp("^"+(str.match(/^(\t| )+/)||"")[0],"gm"),"")}function encodeAttr(str){return(str+"").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function addParagraph(){tags.push({tag:"p",attributes:{key:key++},out:out});out=[]}function tag(tagToken){var desc=TAGS[tagToken.replace(/\*/g,"_")[1]||""];addPrev();if(desc[1]&&tags.length&&tags[tags.length-1].tag===desc[1]&&tags[tags.length-1].tagToken===tagToken){var currentTag=tags.pop();currentTag.out.push(e(currentTag.tag,{key:key++},out));out=currentTag.out;lastIsBlock=false}else{if(desc[0]){if(options.paragraphs){flushTo("p")}if(options.paragraphs&&desc[0]==="br"&&(!tags.length||tags[tags.length-1].tag==="p")){}else{out.push(e(desc[0],{key:key++}))}}if(desc[1]){if(options.paragraphs&&!tags.length){addParagraph()}tags.push({tag:desc[1],attributes:{key:key++},tagToken:tagToken,out:out});out=[];lastIsBlock=false}}}function flushTo(tagType,justAbove){var target=0;if(!tags.length){return}if(tagType){for(target=tags.length-1;target>=0;target--){if(tags[target].tag===tagType){break}}if(justAbove){target++}if(target<0||target>=tags.length){return tags.length}}var i;for(i=tags.length-1;i>=target;i--){if(options.removeTags.indexOf(tags[i].tag.toLowerCase())!==-1){chunk=null}else{if(prev){out.push(prev)}if(options.stripTags.indexOf(tags[i].tag.toLowerCase())!==-1){chunk=null;tags[i].out=tags[i].out.concat(out)}else{tags[i].out.push(e(tags[i].tag,tags[i].attributes||null,out))}}prev=null;chunk=null;out=tags[i].out}chunk=null;if(target){tags=tags.slice(0,target)}else{tags=[]}return tags.length}function clean(string,trimPrev){var cleaned=string.replace(/\n/g," ").replace(/\s+/," ");if(lastIsBlock&&trimPrev){cleaned=cleaned.trim()}else if(trimPrev){cleaned=cleaned.replace(/[\s\uFEFF\xA0]+$/g,"")}else if(lastIsBlock){cleaned=cleaned.replace(/^[\s\uFEFF\xA0]+/g,"")}lastIsBlock=false;return cleaned}function addPrev(trimPrev){if(prev){prev=clean(prev,trimPrev);if(prev){if(options.paragraphs&&!tags.length){addParagraph()}out.push(clean(prev))}prev=""}}function iderize(text){return text.replace(/(?:!\[[^\]]*?\]\([^)]+?)\)/,"").replace(/\[(.*)\](?:\([^)]+?\))?/g,"$1").toLowerCase().replace(/[^\s-_a-z0-9]/g,"").trim().replace(/\s+/g,"-").replace(/-{2,}/g,"-")}function splitAttributes(attributes,parseArguments){if(typeof parseArguments==="undefined"){parseArguments=options.parseArguments}var attributeTokenizer=/\s+((?:([-_a-zA-Z0-9]+)=)?(?:"((?:\\"|[^"])*)"|([^"\s}]+)))/g,split=parseArguments?{arguments:[]}:[],attribute,value;while(attribute=attributeTokenizer.exec(attributes)){if(parseArguments){value=attribute[3]&&attribute[3].replace(/\\"/g,'"')||attribute[4];if(attribute[2]){split[attribute[2]]=value}else{split.arguments.push(value)}}else{if(attribute[2]){split.push(attribute[1])}else{split.push(attribute[3]&&attribute[3].replace(/\\"/g,'"')||attribute[4])}}}if(parseArguments||split.length){return split}}if(!options){options={}}if(!options.removeTags){options.removeTags=["script"]}if(!options.stripTags){options.stripTags=[]}var e;if(!options.createElement){e=function(type,props,children){var element={type:type,props:props};if(children){element.children=children}return element}}else{e=options.createElement}var tokenizer=new RegExp("((?:^|\\n+)(?:\\n---+|\\* \\*(?: \\*)+)\\n)|"+"(?:^``` *(\\w*)\\n([\\s\\S]*?)\\n```$)|"+"((?:(?:^|\\n+)(?:\\t| {2,}).+)+\\n*)|"+"((?:(?:^|\\n)([>*+-]|\\d+\\.)\\s+.*(?:\\n[ \\t]+.*)*)+)|"+"(?:!\\[([^\\]]*?)\\]\\(([^)]+?)\\))|"+"(\\[)|(\\](?:\\(([^)]+?)\\))?)|"+"(?:(?:^|\\n+)([^\\s].*)\\n(-{3,}|={3,})(?:\\n+|$))|"+"(?:(?:^|\\n+)(#{1,6})\\s*(.+)(?:\\n+|$))|"+"(?:`([^`].*?)`)|"+"( {2}\\n\\n*|\\n{2,}|__|\\*\\*|[_*]|~~)|"+'(?:{@(\\w+)((?:\\s+(?:[-_a-zA-Z0-9]+=)?(?:"(?:\\\\"|[^"])*"|[^"\\s}]*))*)})|'+"(?:<\\s*(\\/?)(\\w+)( [^>]+?)?\\s*\\/?>)","gm"),out=[],links=options.referenceLinks||{},last=0,tags=[],key=0,i,j,lastIsBlock=false,chunk,prev,token,t,customTagerizer=/{@(\w+)((?:\s+(?:"(?:\\"|[^"])*"|[^"\s}]*))*)}/;md=md.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(s,name,url){links[name.toLowerCase()]=url.replace(customTagerizer,function(u,customTag,attributes){if(options.customTags&&options.customTags[customTag]){return options.customTags[customTag](splitAttributes(attributes))}else{return""}});return""}).replace(/^\n+|\n+$/g,"");while(token=tokenizer.exec(md)){prev=md.substring(last,token.index);last=tokenizer.lastIndex;chunk=token[0];if(prev.match(/[^\\](\\\\)*\\$/)){}else if(token[3]){if(options.paragraphs){addPrev(true);flushTo("p")}if(options.highlight){chunk=options.highlight(token[3],token[2])}else{chunk=e("pre",{key:key++,className:"code"+(token[2]&&" "+token[2].toLowerCase())},[outdent(encodeAttr(token[3]).replace(/^\n+|\n+$/g,""))]);lastIsBlock=true}}else if(token[4]){if(options.paragraphs){addPrev(true);flushTo("p")}chunk=e("pre",{key:key++,className:"code poetry"},[outdent(encodeAttr(token[4]).replace(/^\n+|\n+$/g,""))]);lastIsBlock=true}else if(token[6]){t=token[6];if(t.match(/\./)){token[5]=token[5].replace(/^\d+/gm,"")}if(options.paragraphs){addPrev(true);flushTo("p")}var parseOptions=Object.assign({},options,{referenceLinks:links,paragraphs:false});if(t===">"){chunk=e("blockquote",{key:key++},parse(outdent(token[5].replace(/^>\s*/gm,"")),parseOptions));lastIsBlock=true}else{t=t.match(/^\d+\./)?"ol":"ul";var items=token[5].split(/^[*+-.]\s/gm);var eItems=[];items.shift();for(i=0;i<items.length;i++){var lines=items[i].split("\n");if(lines.length>1){var spacing=lines[1].match(/^[ \t]+/);if(spacing){spacing=new RegExp("^"+spacing[0]);for(j=1;j<lines.length;j++){lines[j]=lines[j].replace(spacing,"")}items[i]=lines.join("\n")}}eItems.push(e("li",{key:key++},parse(items[i],parseOptions)))}chunk=e(t,{key:key++},eItems);lastIsBlock=true}}else if(token[8]){addPrev();if(options.paragraphs&&!tags.length){addParagraph()}token[8]=token[8].replace(customTagerizer,function(s,customTag,attributes){if(options.customTags&&options.customTags[customTag]){return options.customTags[customTag](splitAttributes(attributes))}else{return""}});var props;if(token[7]){props={key:key++,src:encodeAttr(token[8]),alt:encodeAttr(token[7]),title:encodeAttr(token[7])}}else{props={key:key++,src:encodeAttr(token[8])}}chunk=e("img",props)}else if(token[10]){flushTo("a",true);if(tags.length){if(token[11]){token[11]=token[11].replace(customTagerizer,function(s,customTag,attributes){if(options.customTags&&options.customTags[customTag]){return options.customTags[customTag](splitAttributes(attributes))}else{return""}})}var href=token[11]||links[prev.toLowerCase().trim()];if(href){tags[tags.length-1].attributes.href=encodeAttr(href);if(options.openExternalInNewWindow&&tags[tags.length-1].attributes.href.match(/^https?:\/\//)){tags[tags.length-1].attributes.target="_blank"}}}flushTo("a");lastIsBlock=false}else if(token[9]){addPrev();if(options.paragraphs&&!tags.length){addParagraph()}tags.push({index:token.index,tag:"a",attributes:{key:key++},out:out});out=[];chunk=""}else if(token[12]||token[14]){t="h"+(token[14]?token[14].length:token[13][0]==="="?1:2);if(options.paragraphs){addPrev(true);flushTo("p")}chunk=e(t,options.headingIds?{key:key++,id:iderize(token[12]||token[15])}:{key:key++},parse(token[12]||token[15],Object.assign({},options,{referenceLinks:links,paragraphs:false})));lastIsBlock=true}else if(token[16]){addPrev();if(options.paragraphs&&!tags.length){addParagraph()}chunk=e("code",{key:key++},[encodeAttr(token[16])]);lastIsBlock=false}else if(token[17]||token[1]){tag(token[17]||"--");chunk=null}else if(token[18]){if(options.customTags&&options.customTags[token[18]]){var inParagraph=typeof options.customTags[token[18]]==="object"&&typeof options.customTags[token[18]]!=="undefined"?options.customTags[token[18]].inParagraph:options.tagsInParagraph;var parseArguments=typeof options.customTags[token[18]]==="object"&&typeof options.customTags[token[18]]!=="undefined"?options.customTags[token[18]].parseArguments:options.parseArguments;addPrev(!inParagraph);if(options.paragraphs){if(inParagraph){if(!tags.length){addParagraph()}}else{flushTo("p")}}if(typeof options.customTags[token[18]]==="function"){chunk=options.customTags[token[18]](splitAttributes(token[19],parseArguments))}else if(typeof options.customTags[token[18]].handler==="function"){chunk=options.customTags[token[18]].handler(splitAttributes(token[19],parseArguments))}else{chunk=null}lastIsBlock=!inParagraph}else{chunk=null}}else if(token[21]){chunk="";if(token[20]){if(tags.length){flushTo(token[21])}}else{addPrev(token[21]==="p");if(token[21]==="p"&&options.paragraphs){flushTo("p")}if(token[22]){token[22]=splitAttributes(token[22],true);if(token[22].arguments.length){for(i=0;i<token[22].arguments.length;i++){token[22][token[22].arguments[i]]=true}}delete token[22].arguments;token[22].key=key++}else{token[22]={key:key++}}if(voidTags.indexOf(token[21])!==-1){out.push(e(token[21],token[22]))}else{tags.push({index:token.index,tag:token[21],attributes:token[22],out:out});out=[]}prev=""}}addPrev();if(chunk){out.push(chunk)}}prev=md.substring(last);addPrev();flushTo();return out};module.exports.voidTags=voidTags;
{
"name": "twitchdown",
"version": "1.4.1",
"version": "1.4.2",
"description": "Dead simple Markdown parser for react-like libraries",
"keywords": [
"react",
......@@ -22,12 +22,12 @@
"runkitExampleFilename": "example.js",
"devDependencies": {
"@ava/babel": "^1.0.1",
"ava": "3.9.0",
"eslint": "7.2.0",
"ava": "3.11.1",
"eslint": "7.6.0",
"husky": "^4.2.5",
"lint-staged": "^10.2.10",
"mock-require": "3.0.3",
"preact": "10.4.4",
"preact": "10.4.7",
"react": "16.13.1",
"sinon": "9.0.2",
"uglify-js": "^3.9.4"
......