changed regular expression for table detection
This commit is contained in:
parent
d7c50eaac0
commit
994ae8a71a
|
|
@ -2968,8 +2968,8 @@ function noteApp() {
|
||||||
// List items: lines starting with -, *, + or a number (e.g. 1., 10.), excluding tasks [-]
|
// List items: lines starting with -, *, + or a number (e.g. 1., 10.), excluding tasks [-]
|
||||||
const listItems = (content.match(/^\s*(?:[-*+]|\d+\.)\s+(?!\[)/gm) || []).length;
|
const listItems = (content.match(/^\s*(?:[-*+]|\d+\.)\s+(?!\[)/gm) || []).length;
|
||||||
|
|
||||||
// Tables: separator rows containing both '|' and '---'
|
// Tables: markdown table separator rows (| --- | --- |)
|
||||||
const tables = (content.match(/^(?=.*\|)(?=.*---).*$/gm) || []).length;
|
const tables = (content.match(/^\s*\|(?:\s*:?-+:?\s*\|){1,}\s*$/gm) || []).length;
|
||||||
|
|
||||||
// Link count
|
// Link count
|
||||||
const linkMatches = content.match(/\[([^\]]+)\]\(([^\)]+)\)/g) || [];
|
const linkMatches = content.match(/\[([^\]]+)\]\(([^\)]+)\)/g) || [];
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,9 @@ class Plugin:
|
||||||
re.findall(r'^\s*(?:[-*+]|\d+\.)\s+(?!\[)', content, re.MULTILINE)
|
re.findall(r'^\s*(?:[-*+]|\d+\.)\s+(?!\[)', content, re.MULTILINE)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Tables: count separator rows containing both '|' and '---'
|
# Tables: count markdown table separator rows (| --- | --- |)
|
||||||
tables = len(
|
tables = len(
|
||||||
re.findall(r'^(?=.*\|)(?=.*---).*$', content, re.MULTILINE)
|
re.findall(r'^\s*\|(?:\s*:?-+:?\s*\|){1,}\s*$', content, re.MULTILINE)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Markdown link count
|
# Markdown link count
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue