Update editor, workspace, Git services, appearance, and project guides
This commit is contained in:
@@ -2,6 +2,10 @@ export type TableCell = { text: string; from: number; to: number };
|
||||
export type TableRow = { from: number; to: number; indent: string; cells: TableCell[] };
|
||||
export type MarkdownTable = { rows: TableRow[]; columns: number; eol: string; end: number };
|
||||
|
||||
export function hasTableDelimiter(line: string): boolean {
|
||||
return /(^|[^\\])(?:\\\\)*\|/.test(line);
|
||||
}
|
||||
|
||||
function row(text: string, from: number): TableRow {
|
||||
const pipes: number[] = [];
|
||||
for (let index = 0; index < text.length; index++) {
|
||||
@@ -30,7 +34,7 @@ export function parseMarkdownTable(source: string): MarkdownTable | null {
|
||||
let offset = 0;
|
||||
const eol = source.includes("\r\n") ? "\r\n" : "\n";
|
||||
for (const line of source.split(eol)) {
|
||||
if (!line.trim()) break;
|
||||
if (!line.trim() || (rows.length >= 2 && !hasTableDelimiter(line))) break;
|
||||
rows.push(row(line, offset));
|
||||
offset += line.length + eol.length;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user