From 994ae8a71a239580884ef8c704530f3d3f296d21 Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Tue, 2 Dec 2025 12:00:39 +0100 Subject: [PATCH] changed regular expression for table detection --- frontend/app.js | 4 ++-- plugins/note_stats.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/app.js b/frontend/app.js index e560858..e1d3ae4 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -2968,8 +2968,8 @@ function noteApp() { // List items: lines starting with -, *, + or a number (e.g. 1., 10.), excluding tasks [-] const listItems = (content.match(/^\s*(?:[-*+]|\d+\.)\s+(?!\[)/gm) || []).length; - // Tables: separator rows containing both '|' and '---' - const tables = (content.match(/^(?=.*\|)(?=.*---).*$/gm) || []).length; + // Tables: markdown table separator rows (| --- | --- |) + const tables = (content.match(/^\s*\|(?:\s*:?-+:?\s*\|){1,}\s*$/gm) || []).length; // Link count const linkMatches = content.match(/\[([^\]]+)\]\(([^\)]+)\)/g) || []; diff --git a/plugins/note_stats.py b/plugins/note_stats.py index d3972d0..d1ebdb9 100644 --- a/plugins/note_stats.py +++ b/plugins/note_stats.py @@ -49,9 +49,9 @@ class Plugin: re.findall(r'^\s*(?:[-*+]|\d+\.)\s+(?!\[)', content, re.MULTILINE) ) - # Tables: count separator rows containing both '|' and '---' + # Tables: count markdown table separator rows (| --- | --- |) tables = len( - re.findall(r'^(?=.*\|)(?=.*---).*$', content, re.MULTILINE) + re.findall(r'^\s*\|(?:\s*:?-+:?\s*\|){1,}\s*$', content, re.MULTILINE) ) # Markdown link count