Skip to content

Commit

Permalink
v0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiang Shang committed Sep 2, 2015
1 parent d6268e3 commit 33e2762
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hyperdown",
"version": "0.1.2",
"version": "0.1.3",
"repo": "segmentfault/hyperdown.js",
"description": "A markdown parser",
"keywords": ["markdown", "hyperdown", "html"],
Expand Down
13 changes: 9 additions & 4 deletions hyperdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@
var space = _row[0];
var type = _row[1];
var line = _row[2];
var text = _row[3];
var _text = _row[3];

if (space !== minSpace) {
var pattern = new RegExp("^\s{" + secondMinSpace + "}");
Expand All @@ -913,7 +913,7 @@
html += "<li>" + this.parse(leftLines.join("\n")) + "</li>";
}

leftLines = [text];
leftLines = [_text];
lastType = type;
}
} else {
Expand Down Expand Up @@ -965,7 +965,7 @@

var _loop = function (key) {
var line = lines[key];
if (key === ignore) {
if (parseInt(key) === ignore) {
head = false;
body = true;
return 'continue';
Expand All @@ -979,7 +979,7 @@
line = line.substr(1);

if (line[line.length - 1] === '|') {
line = line.substr(0, -1);
line = line.slice(0, -1);
}
}

Expand Down Expand Up @@ -1342,6 +1342,11 @@
})();

exports['default'] = Parser;

var parser = new Parser();
var text = '| Item | Value | Qty |\n| :-------- | --------:| :--: |\n| Computer | 1600 USD | 5 |\n| Phone | 12 USD | 12 |\n| Pipe | 1 USD | 234 |';

console.log(parser.makeHtml(text));
module.exports = exports['default'];

/***/ },
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Markdown解析器",
"repository": "https://github.com/SegmentFault/HyperDown.js",
"license": "BSD-4-Clause",
"version": "0.1.2",
"version": "0.1.3",
"devDependencies": {
"babel": "^5.8.22",
"babel-core": "^5.8.22",
Expand Down
12 changes: 10 additions & 2 deletions src/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ export default class Parser {

for (let key in lines) {
let line = lines[key]
if (key === ignore) {
if (parseInt(key) === ignore) {
head = false
body = true
continue
Expand All @@ -767,7 +767,7 @@ export default class Parser {
line = line.substr(1)

if (line[line.length - 1] === '|') {
line = line.substr(0, -1)
line = line.slice(0, -1)
}
}

Expand Down Expand Up @@ -1050,3 +1050,11 @@ export default class Parser {
return this
}
}
var parser = new Parser()
var text = `| Item | Value | Qty |
| :-------- | --------:| :--: |
| Computer | 1600 USD | 5 |
| Phone | 12 USD | 12 |
| Pipe | 1 USD | 234 |`

console.log(parser.makeHtml(text))

0 comments on commit 33e2762

Please sign in to comment.