You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You could try converting the HTML to Markdown using Turndown and domino.
importTurndownServicefrom"turndown";importDominofrom"domino";TurndownService.prototype.escape=(string)=>{// Disables string escaping// ref: https://github.com/mixmark-io/turndown#overriding-turndownserviceprototypeescapereturnstring;};constturndownService=newTurndownService();exportconstpreProcessMd=(md: string)=>{// Check if markdown contains html tags, if found transform them to markdown// This function has caveat, it'll return true if a codeblock contains some htmlif(/<\/?[a-z][\s\S]*>/gim.test(md)){constmdWithBR=md.replace(/(?:\r\n|\r|\n)/gm,"<br/>");// to preserve new linesconstdocument=Domino.createDocument(mdWithBR,true);returnturndownService.turndown(document).trim().replace(/[^\S\r\n]+$/gm,"");// Replaces " \n" with "\n", side effect of conversion }};
I'll see how it can be integrated with the library.
Is it possible to add HTML parsing?
The text was updated successfully, but these errors were encountered: