n8n-nodes-notion-advanced 1.2.24-beta → 1.2.26-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -482,15 +482,28 @@ class NotionAITool {
|
|
482
482
|
// Skip completely empty lines and placeholder artifacts
|
483
483
|
if (!trimmedLine || /__BLOCK_\d+__/.test(trimmedLine) || /^\d+__$/.test(trimmedLine))
|
484
484
|
continue;
|
485
|
-
// Skip lines that contain XML tag patterns (to prevent double processing)
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
485
|
+
// Skip lines that contain ANY XML/HTML tag patterns (to prevent double processing)
|
486
|
+
// This is a comprehensive check to ensure NO XML content gets processed twice
|
487
|
+
const hasAnyXmlTags = (
|
488
|
+
// Basic XML/HTML tag detection
|
489
|
+
/<[^>]+>/.test(trimmedLine) ||
|
490
|
+
// HTML-encoded tags
|
491
|
+
/<[^&]+>/.test(trimmedLine) ||
|
492
|
+
// Any opening or closing XML/HTML tags
|
493
|
+
/<\/?[a-zA-Z][a-zA-Z0-9]*[^>]*>/.test(trimmedLine) ||
|
494
|
+
// Self-closing tags
|
495
|
+
/<[a-zA-Z][a-zA-Z0-9]*[^>]*\/>/.test(trimmedLine) ||
|
496
|
+
// Common XML/HTML tag names (comprehensive list)
|
497
|
+
/<\/?(?:h[1-6]|p|div|span|ul|ol|li|strong|b|em|i|code|pre|blockquote|callout|todo|image|embed|bookmark|equation|toggle|quote|divider|br|a|u|s|del|mark)\b[^>]*>/i.test(trimmedLine) ||
|
498
|
+
// Specific attribute patterns
|
499
|
+
/(?:type|src|href|alt|language|checked)="[^"]*"/.test(trimmedLine) ||
|
500
|
+
// Any line that looks like it contains XML structure
|
501
|
+
/^\s*<[^>]+>.*<\/[^>]+>\s*$/.test(trimmedLine) ||
|
502
|
+
// Lines that start or end with XML tags
|
503
|
+
/^\s*<[^>]+>/.test(trimmedLine) ||
|
504
|
+
/<\/[^>]+>\s*$/.test(trimmedLine));
|
505
|
+
if (hasAnyXmlTags) {
|
506
|
+
continue; // Skip ALL lines containing XML content to prevent double processing
|
494
507
|
}
|
495
508
|
// Traditional markdown patterns (for backwards compatibility)
|
496
509
|
if (trimmedLine.startsWith('# ')) {
|
@@ -732,17 +745,19 @@ class NotionAITool {
|
|
732
745
|
return charIndex;
|
733
746
|
}
|
734
747
|
}
|
735
|
-
//
|
748
|
+
// Enhanced hierarchical XML tree structure that catches ALL XML content
|
736
749
|
static buildXMLTree(content, tagProcessors) {
|
750
|
+
var _a;
|
737
751
|
const allMatches = [];
|
738
|
-
|
752
|
+
const processedRanges = [];
|
753
|
+
// Step 1: Collect all XML tags with specific processors
|
739
754
|
tagProcessors.forEach(({ regex, blockCreator, listProcessor }) => {
|
740
755
|
var _a;
|
741
756
|
const globalRegex = new RegExp(regex.source, 'gis');
|
742
757
|
let match;
|
743
758
|
while ((match = globalRegex.exec(content)) !== null) {
|
744
759
|
const tagName = ((_a = match[0].match(/<(\w+)/)) === null || _a === void 0 ? void 0 : _a[1]) || 'unknown';
|
745
|
-
|
760
|
+
const xmlNode = {
|
746
761
|
id: `${tagName}_${match.index}_${Date.now()}_${Math.random()}`,
|
747
762
|
tagName,
|
748
763
|
start: match.index,
|
@@ -755,12 +770,43 @@ class NotionAITool {
|
|
755
770
|
innerContent: match[0],
|
756
771
|
replacement: undefined,
|
757
772
|
listProcessor
|
758
|
-
}
|
773
|
+
};
|
774
|
+
allMatches.push(xmlNode);
|
775
|
+
processedRanges.push({ start: xmlNode.start, end: xmlNode.end });
|
759
776
|
}
|
760
777
|
});
|
761
|
-
//
|
778
|
+
// Step 2: Catch ANY remaining XML/HTML tags that weren't processed by specific processors
|
779
|
+
// This prevents ANY XML content from falling through to traditional processing
|
780
|
+
const genericXmlRegex = /<[^>]+>[\s\S]*?<\/[^>]+>|<[^>]+\/>/gis;
|
781
|
+
let genericMatch;
|
782
|
+
while ((genericMatch = genericXmlRegex.exec(content)) !== null) {
|
783
|
+
const matchStart = genericMatch.index;
|
784
|
+
const matchEnd = genericMatch.index + genericMatch[0].length;
|
785
|
+
// Check if this match overlaps with any already processed range
|
786
|
+
const hasOverlap = processedRanges.some(range => (matchStart < range.end && matchEnd > range.start));
|
787
|
+
if (!hasOverlap) {
|
788
|
+
const tagName = ((_a = genericMatch[0].match(/<(\w+)/)) === null || _a === void 0 ? void 0 : _a[1]) || 'generic';
|
789
|
+
const xmlNode = {
|
790
|
+
id: `${tagName}_${matchStart}_${Date.now()}_${Math.random()}`,
|
791
|
+
tagName,
|
792
|
+
start: matchStart,
|
793
|
+
end: matchEnd,
|
794
|
+
match: genericMatch[0],
|
795
|
+
processor: () => null, // Generic processor that just removes the content
|
796
|
+
groups: [],
|
797
|
+
children: [],
|
798
|
+
depth: 0,
|
799
|
+
innerContent: genericMatch[0],
|
800
|
+
replacement: undefined,
|
801
|
+
listProcessor: undefined
|
802
|
+
};
|
803
|
+
allMatches.push(xmlNode);
|
804
|
+
processedRanges.push({ start: matchStart, end: matchEnd });
|
805
|
+
}
|
806
|
+
}
|
807
|
+
// Sort by start position to maintain document order
|
762
808
|
allMatches.sort((a, b) => a.start - b.start);
|
763
|
-
// Build parent-child relationships
|
809
|
+
// Build parent-child relationships while preserving ordering
|
764
810
|
const rootNodes = [];
|
765
811
|
const nodeStack = [];
|
766
812
|
for (const node of allMatches) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "n8n-nodes-notion-advanced",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.26-beta",
|
4
4
|
"description": "Advanced n8n Notion nodes: Full-featured workflow node + AI Agent Tool for intelligent Notion automation with 25+ block types (BETA)",
|
5
5
|
"scripts": {},
|
6
6
|
"files": [
|