diff --git a/components/content/ContentMarkdownRenderer.vue b/components/content/ContentMarkdownRenderer.vue index 6ea6caf..7ac9ab7 100644 --- a/components/content/ContentMarkdownRenderer.vue +++ b/components/content/ContentMarkdownRenderer.vue @@ -26,6 +26,8 @@ const createBlock = (type = 'paragraph', text = '', level = null, id = '', optio url: options.url || '', alt: options.alt || '', title: options.title || '', + variant: options.variant || '', + ordered: options.ordered || false, width: options.width || 'regular', images: options.images || [] }) @@ -89,6 +91,20 @@ const parseMarkdownBlocks = (markdown) => { continue } + if (trimmedLine === '>>>') { + const contentLines = [] + index += 1 + + while (index < lines.length && lines[index].trim() !== '<<<') { + contentLines.push(lines[index]) + index += 1 + } + + blocks.push(createBlock('quote', contentLines.join('\n').trim(), null, `block-${blocks.length}`, { variant: 'alt' })) + index += 1 + continue + } + if (trimmedLine === ':::gallery') { const { contentLines, nextIndex } = collectFencedLines(lines, index + 1) const images = [] @@ -155,7 +171,7 @@ const parseMarkdownBlocks = (markdown) => { continue } - const headingMatch = trimmedLine.match(/^(#{1,3})\s+(.+)$/) + const headingMatch = trimmedLine.match(/^(#{1,6})\s+(.+)$/) if (headingMatch) { blocks.push(createBlock('heading', headingMatch[2], headingMatch[1].length, `block-${blocks.length}`)) @@ -164,8 +180,14 @@ const parseMarkdownBlocks = (markdown) => { } if (trimmedLine.startsWith('> ')) { - blocks.push(createBlock('quote', trimmedLine.replace(/^>\s?/, ''), null, `block-${blocks.length}`)) - index += 1 + const quoteLines = [] + + while (index < lines.length && lines[index].trim().startsWith('>')) { + quoteLines.push(lines[index].trim().replace(/^>\s?/, '')) + index += 1 + } + + blocks.push(createBlock('quote', quoteLines.join('\n').trim(), null, `block-${blocks.length}`)) continue } @@ -181,6 +203,18 @@ const parseMarkdownBlocks = (markdown) => { continue } + if (/^\d+\.\s+/.test(trimmedLine)) { + const items = [] + + while (index < lines.length && /^\d+\.\s+/.test(lines[index].trim())) { + items.push(lines[index].trim().replace(/^\d+\.\s+/, '')) + index += 1 + } + + blocks.push(createBlock('list', items, null, `block-${blocks.length}`, { ordered: true })) + continue + } + blocks.push(createBlock('paragraph', trimmedLine, null, `block-${blocks.length}`)) index += 1 } @@ -236,10 +270,10 @@ const showNextImage = () => { {{ block.text }} - + {{ block.text }} - +
  • {{ item }}
  • @@ -258,7 +292,7 @@ const showNextImage = () => {