Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions utils/markdownToGoogleDocs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
// Function to remove '**' bold markers from markdown text
function removeBoldMarkers(markdown) {
return markdown.replace(/\*\*(.*?)\*\*/g, '$1');
}

// Modified parseMarkdown function
export function parseMarkdown(markdown, workgroup, date) {
// Remove bold markers before processing
markdown = removeBoldMarkers(markdown);

const requests = [];
let currentIndex = 1;

Expand Down Expand Up @@ -105,28 +114,8 @@ export function parseMarkdown(markdown, workgroup, date) {
});
}

// Apply bold formatting
let boldStart = -1;
for (let i = 0; i < text.length; i++) {
if (text.substring(i, i + 2) === '**') {
if (boldStart === -1) {
boldStart = i;
} else {
requests.push({
updateTextStyle: {
range: {
startIndex: currentIndex - text.length + boldStart + 2,
endIndex: currentIndex - text.length + i,
},
textStyle: { bold: true },
fields: 'bold',
},
});
boldStart = -1;
}
}
}
// Bold formatting is no longer needed as we removed the markers
});

return requests;
}
}