n8n-nodes-notion-advanced 1.2.1-beta → 1.2.2-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.
@@ -10,6 +10,7 @@ export declare class NotionAITool implements INodeType {
|
|
10
10
|
static queryDatabase(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
|
11
11
|
static parseContentToBlocks(content: string): IDataObject[];
|
12
12
|
static processXmlTags(content: string, blocks: IDataObject[]): string;
|
13
|
+
static cleanupRemainingHtml(content: string): string;
|
13
14
|
static getCalloutEmoji(type: string): string;
|
14
15
|
static getCalloutColor(type: string): string;
|
15
16
|
static parseBasicMarkdown(text: string): IDataObject[];
|
@@ -828,51 +828,42 @@ class NotionAITool {
|
|
828
828
|
return `__XML_BLOCK_${blockCounter++}__`;
|
829
829
|
}
|
830
830
|
},
|
831
|
-
//
|
831
|
+
// Process complete bulleted lists first: <ul><li>item</li></ul>
|
832
832
|
{
|
833
|
-
regex: /<ul
|
833
|
+
regex: /<ul\s*[^>]*>(.*?)<\/ul>/gis,
|
834
834
|
processor: (match, listContent) => {
|
835
|
-
// Extract individual list items
|
836
|
-
const items = listContent.match(/<li
|
835
|
+
// Extract individual list items and process them
|
836
|
+
const items = listContent.match(/<li\s*[^>]*>(.*?)<\/li>/gis) || [];
|
837
837
|
items.forEach(item => {
|
838
|
-
const itemContent = item.replace(/<\/?li
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
838
|
+
const itemContent = item.replace(/<\/?li[^>]*>/gi, '').trim();
|
839
|
+
if (itemContent) {
|
840
|
+
blocks.push({
|
841
|
+
type: 'bulleted_list_item',
|
842
|
+
bulleted_list_item: {
|
843
|
+
rich_text: NotionAITool.parseBasicMarkdown(itemContent),
|
844
|
+
},
|
845
|
+
});
|
846
|
+
}
|
845
847
|
});
|
846
848
|
return `__XML_BLOCK_${blockCounter++}__`;
|
847
849
|
}
|
848
850
|
},
|
849
|
-
//
|
851
|
+
// Process complete numbered lists first: <ol><li>item</li></ol>
|
850
852
|
{
|
851
|
-
regex: /<ol
|
853
|
+
regex: /<ol\s*[^>]*>(.*?)<\/ol>/gis,
|
852
854
|
processor: (match, listContent) => {
|
853
|
-
// Extract individual list items
|
854
|
-
const items = listContent.match(/<li
|
855
|
+
// Extract individual list items and process them
|
856
|
+
const items = listContent.match(/<li\s*[^>]*>(.*?)<\/li>/gis) || [];
|
855
857
|
items.forEach(item => {
|
856
|
-
const itemContent = item.replace(/<\/?li
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
}
|
866
|
-
},
|
867
|
-
// Standalone list items: <li>content</li>
|
868
|
-
{
|
869
|
-
regex: /<li>(.*?)<\/li>/gis,
|
870
|
-
processor: (match, content) => {
|
871
|
-
blocks.push({
|
872
|
-
type: 'bulleted_list_item',
|
873
|
-
bulleted_list_item: {
|
874
|
-
rich_text: NotionAITool.parseBasicMarkdown(content.trim()),
|
875
|
-
},
|
858
|
+
const itemContent = item.replace(/<\/?li[^>]*>/gi, '').trim();
|
859
|
+
if (itemContent) {
|
860
|
+
blocks.push({
|
861
|
+
type: 'numbered_list_item',
|
862
|
+
numbered_list_item: {
|
863
|
+
rich_text: NotionAITool.parseBasicMarkdown(itemContent),
|
864
|
+
},
|
865
|
+
});
|
866
|
+
}
|
876
867
|
});
|
877
868
|
return `__XML_BLOCK_${blockCounter++}__`;
|
878
869
|
}
|
@@ -904,9 +895,24 @@ class NotionAITool {
|
|
904
895
|
return `__XML_BLOCK_${blockCounter++}__`;
|
905
896
|
}
|
906
897
|
},
|
907
|
-
//
|
898
|
+
// Standalone list items (only if not already processed in lists): <li>content</li>
|
908
899
|
{
|
909
|
-
regex: /<(
|
900
|
+
regex: /<li\s*[^>]*>(.*?)<\/li>/gis,
|
901
|
+
processor: (match, content) => {
|
902
|
+
if (content.trim()) {
|
903
|
+
blocks.push({
|
904
|
+
type: 'bulleted_list_item',
|
905
|
+
bulleted_list_item: {
|
906
|
+
rich_text: NotionAITool.parseBasicMarkdown(content.trim()),
|
907
|
+
},
|
908
|
+
});
|
909
|
+
}
|
910
|
+
return `__XML_BLOCK_${blockCounter++}__`;
|
911
|
+
}
|
912
|
+
},
|
913
|
+
// Strong/Bold: <strong>content</strong> or <b>content</b> (only as standalone)
|
914
|
+
{
|
915
|
+
regex: /(?:^|>|\s)<(strong|b)>(.*?)<\/(strong|b)>(?=<|$|\s)/gis,
|
910
916
|
processor: (match, tag, content) => {
|
911
917
|
blocks.push({
|
912
918
|
type: 'paragraph',
|
@@ -917,9 +923,9 @@ class NotionAITool {
|
|
917
923
|
return `__XML_BLOCK_${blockCounter++}__`;
|
918
924
|
}
|
919
925
|
},
|
920
|
-
// Emphasis/Italic: <em>content</em> or <i>content</i>
|
926
|
+
// Emphasis/Italic: <em>content</em> or <i>content</i> (only as standalone)
|
921
927
|
{
|
922
|
-
regex:
|
928
|
+
regex: /(?:^|>|\s)<(em|i)>(.*?)<\/(em|i)>(?=<|$|\s)/gis,
|
923
929
|
processor: (match, tag, content) => {
|
924
930
|
blocks.push({
|
925
931
|
type: 'paragraph',
|
@@ -950,8 +956,35 @@ class NotionAITool {
|
|
950
956
|
return processor(match, group1 || '', group2 || '', group3 || '');
|
951
957
|
});
|
952
958
|
});
|
959
|
+
// Clean up any remaining HTML tags that weren't processed
|
960
|
+
processedContent = NotionAITool.cleanupRemainingHtml(processedContent);
|
953
961
|
return processedContent;
|
954
962
|
}
|
963
|
+
// Cleanup function to remove remaining HTML tags
|
964
|
+
static cleanupRemainingHtml(content) {
|
965
|
+
let cleaned = content;
|
966
|
+
// Remove common HTML tags that might be left behind
|
967
|
+
const htmlTagsToRemove = [
|
968
|
+
/<\/?ul\s*[^>]*>/gi,
|
969
|
+
/<\/?ol\s*[^>]*>/gi,
|
970
|
+
/<\/?li\s*[^>]*>/gi,
|
971
|
+
/<\/?strong\s*[^>]*>/gi,
|
972
|
+
/<\/?b\s*[^>]*>/gi,
|
973
|
+
/<\/?em\s*[^>]*>/gi,
|
974
|
+
/<\/?i\s*[^>]*>/gi,
|
975
|
+
/<\/?div\s*[^>]*>/gi,
|
976
|
+
/<\/?span\s*[^>]*>/gi,
|
977
|
+
/<br\s*\/?>/gi,
|
978
|
+
];
|
979
|
+
htmlTagsToRemove.forEach(regex => {
|
980
|
+
cleaned = cleaned.replace(regex, '');
|
981
|
+
});
|
982
|
+
// Remove empty lines created by tag removal
|
983
|
+
cleaned = cleaned.replace(/^\s*[\r\n]/gm, '');
|
984
|
+
// Remove multiple consecutive line breaks
|
985
|
+
cleaned = cleaned.replace(/\n{3,}/g, '\n\n');
|
986
|
+
return cleaned.trim();
|
987
|
+
}
|
955
988
|
// Helper function to get callout emoji based on type
|
956
989
|
static getCalloutEmoji(type) {
|
957
990
|
const emojiMap = {
|
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.2-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
|
"build": "echo 'Already built'",
|