fix(vetur): fix markdown vetur output format
This commit is contained in:
@@ -24,6 +24,18 @@ function readLine(input: string) {
|
||||
return input.substr(0, end !== -1 ? end : input.length);
|
||||
}
|
||||
|
||||
function splitTableLine(line: string) {
|
||||
line = line.replace('\\|', 'JOIN');
|
||||
|
||||
const items = line.split('|').map(item => item.trim().replace('JOIN', '|'));
|
||||
|
||||
// remove pipe character on both sides
|
||||
items.pop();
|
||||
items.shift();
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
function tableParse(input: string) {
|
||||
let start = 0;
|
||||
let isHead = true;
|
||||
@@ -44,25 +56,11 @@ function tableParse(input: string) {
|
||||
|
||||
if (TABLE_SPLIT_LINE_REG.test(target)) {
|
||||
isHead = false;
|
||||
} else if (isHead) {
|
||||
// temp do nothing
|
||||
} else {
|
||||
} else if (!isHead && line.includes('|')) {
|
||||
const matched = line.trim().match(TD_REG);
|
||||
|
||||
if (matched) {
|
||||
table.body.push(
|
||||
matched.map(i => {
|
||||
if (i.indexOf('|') !== 0) {
|
||||
return i
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.split('|')
|
||||
.map(s => s.trim())
|
||||
.join('|');
|
||||
}
|
||||
return i.trim();
|
||||
})
|
||||
);
|
||||
table.body.push(splitTableLine(line));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user