Improve look of app, ive broken accordion content so will need to fix
This commit is contained in:
@@ -97,12 +97,19 @@ export const StepAccordion = {
|
||||
},
|
||||
};
|
||||
|
||||
// You must provide a markdownToHTML() function or use a library like marked.js
|
||||
// Use marked.js for robust Markdown to HTML conversion
|
||||
const renderer = new marked.Renderer();
|
||||
renderer.image = (href, title, text) => {
|
||||
// Add Tailwind classes for styling images
|
||||
return `<img src="${href}" alt="${text}" title="${
|
||||
title || ""
|
||||
}" class="my-2 rounded shadow max-w-full h-auto mx-auto">`;
|
||||
};
|
||||
|
||||
marked.setOptions({ renderer });
|
||||
|
||||
function markdownToHTML(text) {
|
||||
return text
|
||||
.replace(/\n/g, "<br>")
|
||||
.replace(
|
||||
/!\[(.*?)\]\((.*?)\)/g,
|
||||
'<img alt="$1" src="$2" class="my-2 rounded shadow max-w-full">'
|
||||
);
|
||||
// Replace escaped newlines from template literals with actual newlines for marked
|
||||
const processedText = text.replace(/\\n/g, "\n");
|
||||
return marked.parse(processedText);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user