Skip to content

Commit

Permalink
feature: 修复传入字符串没有HTML标签时报错的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
siaikin committed Oct 21, 2019
1 parent c0d5e06 commit 0339273
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/lib/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Object.defineProperties(Lexer.prototype, {
/**
* 分解传入的HTML字符串
* @param str - HTML字符串
* @return {[]}
* @return {Array}
*/
function analysis(str) {
str = Tools.trim(str);
Expand All @@ -38,6 +38,12 @@ function analysis(str) {
end = i;
result.push(str.slice(start, end + 1));
}
break;
default:
if (i === len - 1) {
result.push(str.slice(end, len));
}
break;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/lib/mdReverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function toMarkdown(htmlStr) {
result = parser.analysis(result);
result = vdomtree.build(result);
result = md.translate(result);
console.log(result);
return result;
}

Expand Down

0 comments on commit 0339273

Please sign in to comment.