Skip to content

Commit f08bff4

Browse files
Merge pull request #144 from SingularityNET-Archive:development
refactor: Remove bold markers from markdown text in parseMarkdown function
2 parents c4856a4 + 19762cc commit f08bff4

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

utils/markdownToGoogleDocs.js

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
// Function to remove '**' bold markers from markdown text
2+
function removeBoldMarkers(markdown) {
3+
return markdown.replace(/\*\*(.*?)\*\*/g, '$1');
4+
}
5+
6+
// Modified parseMarkdown function
17
export function parseMarkdown(markdown, workgroup, date) {
8+
// Remove bold markers before processing
9+
markdown = removeBoldMarkers(markdown);
10+
211
const requests = [];
312
let currentIndex = 1;
413

@@ -105,28 +114,8 @@ export function parseMarkdown(markdown, workgroup, date) {
105114
});
106115
}
107116

108-
// Apply bold formatting
109-
let boldStart = -1;
110-
for (let i = 0; i < text.length; i++) {
111-
if (text.substring(i, i + 2) === '**') {
112-
if (boldStart === -1) {
113-
boldStart = i;
114-
} else {
115-
requests.push({
116-
updateTextStyle: {
117-
range: {
118-
startIndex: currentIndex - text.length + boldStart + 2,
119-
endIndex: currentIndex - text.length + i,
120-
},
121-
textStyle: { bold: true },
122-
fields: 'bold',
123-
},
124-
});
125-
boldStart = -1;
126-
}
127-
}
128-
}
117+
// Bold formatting is no longer needed as we removed the markers
129118
});
130119

131120
return requests;
132-
}
121+
}

0 commit comments

Comments
 (0)