From c5f1c002cddf797c1f21c33a9f686b761d2de8f8 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 20:18:57 +0000 Subject: [PATCH 1/2] feat: enhance markdown parser and styling in LoginModal - Rewrite `renderMarkdown` to support strict indentation-based nested lists. - Support H4 headers and adjust header indentation (H1 centered, H2 flush, H3/H4 indented). - Support horizontal rules (`---` or `***`). - Fix list marker stripping to support `* **Bold**` patterns correctly. - Enhance LoginModal UI with increased height and custom scrollbar styling. --- src/components/LoginModal.jsx | 186 ++++++++++++++++++++++++---------- 1 file changed, 134 insertions(+), 52 deletions(-) diff --git a/src/components/LoginModal.jsx b/src/components/LoginModal.jsx index f1b6c49..262b4ac 100644 --- a/src/components/LoginModal.jsx +++ b/src/components/LoginModal.jsx @@ -2,99 +2,166 @@ import React, { useState, useEffect } from 'react'; import { X, LogIn, UserPlus, Github, Mail } from 'lucide-react'; import { api } from '../services/api'; -// Custom Markdown Renderer to ensure consistent styling without dependencies +// Custom Markdown Renderer const renderMarkdown = (text) => { if (!text) return null; const lines = text.split('\n'); const elements = []; let listBuffer = []; - let currentIndent = 0; // 0 for H1, 1 for H2, 2 for H3... used for indentation // Helper to parse inline styles (Bold and Links) const parseInline = (text) => { + if (!text) return { __html: '' }; + // Pass 1: Links [text](url) - // We use a callback to handle styling logic let processed = text.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (match, txt, url) => { const isGreen = txt.includes('CR200J') || url.includes('CR200J'); const classes = isGreen ? "text-emerald-600 hover:text-emerald-800 hover:underline transition-colors font-medium" : "text-blue-600 hover:text-blue-800 hover:underline transition-colors font-medium"; - // Ensure we don't break subsequent bold parsing if link text has stars (unlikely but safe to assume standard markdown) return `${txt}`; }); // Pass 2: Bold (**text**) - // We strictly match **...** and wrap in - // Note: This simple regex might struggle with nested complex HTML but works for standard MD usage here. processed = processed.replace(/\*\*(.*?)\*\*/g, '$1'); return { __html: processed }; }; + // Helper to render buffered list items into a nested structure const flushList = () => { - if (listBuffer.length > 0) { - elements.push( -