import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class MarkdownService {
transformCustomBlocks(content: string): string {
if (!content) return '';
return content
.replace(/\[gallery\]\s*([\s\S]*?)\s*\[\/gallery\]/g, (_, inner: string) => {
const images = inner
.split('\n')
.map((line) => this.sanitizeImageUrl(line))
.filter((url): url is string => url !== null)
.map((url) => ``)
.join('');
return `