${escapedCode}`;
});
- // Process footnotes before basic markdown to prevent unwanted paragraph tags
+ // Process footnotes
processedText = processFootnotes(processedText);
- // Process async elements
- processedText = await processNostrIdentifiers(processedText);
+ // Process basic markdown (which will also handle Nostr identifiers)
processedText = await parseBasicMarkdown(processedText);
// Step 3: Restore code blocks
@@ -408,9 +373,6 @@ export async function parseAdvancedMarkdown(text: string): Promise${lines.join('\n')}
${ lines.join('\n') }`; @@ -109,113 +133,43 @@ function processBlockquotes(content: string): string { } } -/** - * Calculate indentation level from spaces - */ -function getIndentLevel(spaces: string): number { - return Math.floor(spaces.length / 2); -} - -/** - * Process lists (ordered and unordered) - */ -function processLists(content: string): string { - const lines = content.split('\n'); - const processed: string[] = []; - const listStack: { type: 'ol' | 'ul', items: string[], level: number }[] = []; - - function closeList() { - if (listStack.length > 0) { - const list = listStack.pop()!; - const listType = list.type; - const listClass = listType === 'ol' ? 'list-decimal' : 'list-disc'; - const indentClass = list.level > 0 ? 'ml-6' : 'ml-4'; - let listHtml = `<${listType} class="${listClass} ${indentClass} my-2 space-y-2">`; - list.items.forEach(item => { - listHtml += `\n
${para}
`) + .join('\n'); // Process Nostr identifiers last processedText = await processNostrIdentifiers(processedText); @@ -223,9 +177,6 @@ export async function parseBasicMarkdown(text: string): Promise