remix-nlux
Version:
Remix IDE NLUX integration. Remix IDE is the leading IDE for building and deploying smart contracts on Ethereum. NLUX is a JavaScript and React library for building conversational AI experiences.
17 lines (12 loc) • 447 B
text/typescript
const spaceToNbsp = (match: string) => {
return new Array(match.length + 1).join(' ');
};
export const textToHtml = (message: string): string => {
// Remove any existing HTML tags
let result = message.replace(/<\/?[^>]+(>|$)/g, '');
// Convert newlines to <br>
result = result.replace(/\n/g, '<br />');
// Convert multiple spaces to
result = result.replace(/\s\s+/g, spaceToNbsp);
return result;
};