I just threw the question at ChatGPT to create javascript. This is untested, but just looking at the code, I believe it should work. Pass your comma delimited list as the p1 parameter. The result should be html that you can use in a rich text component.
function createBluePillsList(input) {
// Split the input string into an array of words
const words = input.split(',');
// Create an empty string to store the HTML
let html = '';
// Loop through each word and create a blue pill for it
words.forEach(word => {
// Trim the word to remove leading/trailing spaces
const trimmedWord = word.trim();
// Add the HTML for the blue pill with inline styling
html += `<span style="background-color: #0074D9; color: white; padding: 4px 8px; margin: 4px; border-radius: 15px;">${trimmedWord}</span>`;
});
// Return the HTML string
return html;
}
return createBluePillsList(p1);