Skip to content

Niteshagarwal01/githubreadmegenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

94 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GitHub README Generator β€” Professional Documentation Tool (small build#13)

image

A professional README generator featuring real-time markdown preview, multi-section support, and automatic badge generation. Built with vanilla JavaScript and elegant glassmorphic design for a premium user experience.

πŸš€ Features

  • Real-Time Preview: Live markdown rendering with instant updates as you type.
  • Multi-Section Support: Comprehensive form for Description, Features, Installation, Usage, Technologies, Contributing, License, and Author details.
  • Automatic Badge Generation: Smart badge creation for MIT, Apache, GPL, Node.js, React, JavaScript, TypeScript, Python, HTML, and CSS.
  • Copy to Clipboard: One-click functionality to copy generated markdown.
  • Debounced Auto-Generation: Optimized 1-second delay for smooth typing experience.
  • Glassmorphic UI: Premium frosted glass design with backdrop blur and elegant shadows.
  • Responsive Grid Layout: 2-column layout (form + preview) adapts seamlessly to mobile devices.
  • Table of Contents Generation: Automatic TOC creation based on filled sections.
  • Sample Data Loading: Pre-filled example on first visit for instant preview.
  • Professional Icons: Inline SVG icons for enhanced visual hierarchy.
  • No Dependencies: Pure vanilla JavaScript with zero external libraries.

πŸ’» Run Locally

  1. Clone the repository or download the files:
    git clone https://github.com/Niteshagarwal01/githubreadmegenerator.git
    cd githubreadmegenerator
  2. Open index.html in your browser.
  3. No Installation Required: Pure vanilla JavaScript - works immediately in any modern browser.
  4. No External Dependencies: Completely self-contained with no API calls or libraries.

πŸ”§ Customization

  • Color Scheme: Modify CSS custom properties to change the glassmorphic theme:

    :root {
      --primary-color: #0ea5e9;           /* Primary accent (Sky Blue) */
      --secondary-color: #06b6d4;         /* Secondary accent (Cyan) */
      --glass-bg: rgba(255, 255, 255, 0.08);    /* Glass background */
      --glass-border: rgba(255, 255, 255, 0.18); /* Glass border */
      --text-primary: #f8fafc;            /* Primary text color */
      --text-secondary: #cbd5e1;          /* Secondary text color */
    }
  • Add Custom Badges:

    const badgeMap = {
      'YourTech': '[![YourTech](https://img.shields.io/badge/YourTech-color?style=flat&logo=yourlogo)](https://yourtech.com/)',
      // Add more custom badges
    };
  • Modify Debounce Delay:

    debounceTimer = setTimeout(() => {
      // ... generation logic
    }, 500); // Change from 1000ms to 500ms
  • Change Font Pairing:

    @import url('https://fonts.googleapis.com/css2?family=Raleway:wght@600;700;800&family=Dancing+Script&display=swap');
    
    body {
      font-family: 'Raleway', sans-serif;
    }
    
    header h1 {
      font-family: 'Dancing Script', cursive;
    }
  • Adjust Grid Layout:

    .main-content {
      grid-template-columns: 1fr 1fr; /* Equal columns */
      /* or */
      grid-template-columns: 2fr 1fr; /* Larger form, smaller preview */
    }

πŸ› οΈ Tech Stack

  • Frontend: HTML5 with semantic structure and form validation.
  • Logic: Vanilla JavaScript (ES6+) with real-time input handling, debouncing, and markdown generation algorithms.
  • Styling: CSS3 with Custom Properties, Glassmorphic design, backdrop-filter blur effects, gradient accents.
  • Typography: Montserrat (bold sans-serif) + Pacifico (elegant script) from Google Fonts.
  • Architecture: Event-driven design with clean separation of concerns (UI rendering, markdown generation, clipboard API).

πŸ“‚ File Structure

  • index.html - DOM structure with form inputs, glassmorphic containers, SVG icons, and preview panel.
  • styles.css - Glassmorphic styling with blur effects, gradient accents, and responsive design.
  • script.js - Core logic for markdown generation, badge creation, debouncing, and clipboard management.

βš™οΈ How It Works

The application manages form state and generates markdown dynamically:

// Badge Generation System
const badgeMap = {
  'MIT': '[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)',
  'React': '[![React](https://img.shields.io/badge/React-20232A?style=flat&logo=react&logoColor=61DAFB)](https://reactjs.org/)',
  'Node.js': '[![Node.js](https://img.shields.io/badge/Node.js-43853D?style=flat&logo=node.js&logoColor=white)](https://nodejs.org/)',
  // Custom badges for unrecognized technologies
  'Custom': '![${badge}](https://img.shields.io/badge/${badge}-informational)'
}

function generateBadges(badgeString) {
  const badgeList = badgeString.split(',').map(b => b.trim()).filter(b => b);
  return badgeList.map(badge => badgeMap[badge] || `![${badge}](https://img.shields.io/badge/${badge.replace(/ /g, '%20')}-informational)`).join(' ') + '\n\n';
}

πŸ“ Usage Examples

Markdown Generation:

function generateReadme() {
  const title = projectTitle.value.trim();
  const description = projectDescription.value.trim();
  
  if (!title || !description) {
    showToast('Please fill in the required fields (Title and Description)', 'error');
    return;
  }
  
  let readme = '';
  
  // Title
  readme += `# ${title}\n\n`;
  
  // Badges (automatic generation)
  const badgeMarkdown = generateBadges(badges.value);
  if (badgeMarkdown) readme += badgeMarkdown;
  
  // Description
  readme += `## Description\n\n${description}\n\n`;
  
  // Screenshot (if provided)
  if (screenshot.value.trim()) {
    readme += `## Screenshot\n\n![Screenshot](${screenshot.value})\n\n`;
  }
  
  // Auto-generated Table of Contents
  readme += `## Table of Contents\n\n`;
  readme += `- [Features](#features)\n`;
  if (installation.value.trim()) readme += `- [Installation](#installation)\n`;
  if (usage.value.trim()) readme += `- [Usage](#usage)\n`;
  // ... dynamic TOC based on filled sections
  
  // Features with custom bullet points
  if (features.value.trim()) {
    readme += `## Features\n\n`;
    features.value.split('\n').filter(f => f.trim()).forEach(feature => {
      readme += `- ${feature.trim()}\n`;
    });
    readme += `\n`;
  }
  
  // Update preview
  preview.innerHTML = readme;
  showToast('README generated successfully!', 'success');
}

Debounced Auto-Generation:

// Optimize performance with debouncing
let debounceTimer;
const inputs = document.querySelectorAll('input, textarea, select');

inputs.forEach(input => {
  input.addEventListener('input', () => {
    clearTimeout(debounceTimer);
    debounceTimer = setTimeout(() => {
      if (projectTitle.value.trim() && projectDescription.value.trim()) {
        generateReadme();
      }
    }, 1000); // 1-second delay
  });
});

Copy to Clipboard API:

async function copyToClipboard() {
  const text = preview.textContent;
  
  if (text.includes('Fill in the form')) {
    showToast('Please generate a README first!', 'error');
    return;
  }
  
  try {
    await navigator.clipboard.writeText(text);
    showToast('Copied to clipboard!', 'success');
  } catch (err) {
    // Fallback for older browsers
    const textArea = document.createElement('textarea');
    textArea.value = text;
    textArea.style.position = 'fixed';
    textArea.style.left = '-999999px';
    document.body.appendChild(textArea);
    textArea.select();
    document.execCommand('copy');
    document.body.removeChild(textArea);
    showToast('Copied to clipboard!', 'success');
  }
}

Toast Notification System:

function showToast(message, type = 'success') {
  const existingToast = document.querySelector('.toast');
  if (existingToast) existingToast.remove();
  
  const toast = document.createElement('div');
  toast.className = 'toast';
  toast.textContent = message;
  
  if (type === 'error') {
    toast.style.background = 'rgba(239, 68, 68, 0.2)';
    toast.style.borderColor = 'rgba(239, 68, 68, 0.3)';
  } else {
    toast.style.background = 'rgba(14, 165, 233, 0.2)';
    toast.style.borderColor = 'rgba(14, 165, 233, 0.3)';
  }
  
  document.body.appendChild(toast);
  
  setTimeout(() => {
    toast.style.animation = 'slideOut 0.3s ease';
    setTimeout(() => toast.remove(), 300);
  }, 3000);
}

🎨 UI/UX Features

  • Glassmorphic Design: Frosted glass aesthetic with backdrop blur (20px) and semi-transparent surfaces.
  • Gradient Accents: Sky Blue to Cyan gradients on buttons, section underlines, and scrollbars.
  • Smooth Transitions: All interactive elements have 0.3s ease transitions for polished feel.
  • Hover Effects: Cards lift on hover with enhanced shadows and border glow.
  • Form Validation: Required field indicators and error toasts for empty submissions.
  • SVG Icons: Inline icons for Demo and Screenshot fields with consistent styling.
  • Dark Background: Gradient background (slate to dark blue) for premium contrast.
  • Responsive Grid: 2-column desktop layout collapses to single column on mobile (<1024px).
  • Sticky Preview: Preview panel sticks to viewport while scrolling form.
  • Custom Scrollbar: Gradient-styled scrollbar matching theme colors.
  • Auto-Focus: Input automatically focused when Generate button clicked.
  • Button Shimmer: Hover animation with sliding gradient overlay effect.

⚑ Key Functions

Function Purpose
generateReadme() Main function to compile all form inputs into markdown format
generateBadges(badgeString) Parse comma-separated badges and return Shield.io markdown
resetForm() Clear all form inputs and preview, restore placeholder text
copyToClipboard() Copy generated markdown to clipboard using Clipboard API
showToast(message, type) Display temporary notification with success/error styling
debounceTimer Optimize auto-generation with 1-second input delay
Event Listeners Attach click and input handlers for all form elements
localStorage Store first-visit flag to load sample data once

πŸ“Š Supported Sections

Auto-Generated Sections:

  • Title (H1 heading)
  • Badges (Shield.io format)
  • Description
  • Screenshot (if URL provided)
  • Demo Link (if URL provided)
  • Table of Contents (dynamic based on filled sections)
  • Features (bullet list)
  • Installation (code block)
  • Usage (paragraph)
  • Technologies (bullet list)
  • Contributing (paragraph)
  • License (auto-formatted)
  • Author (GitHub link + email)
  • Footer (star request message)

🎯 Features Comparison

Feature Basic Generator Professional Generator ✨
Real-time Preview ❌ βœ… With debouncing
Badge Generation ❌ βœ… 10+ predefined badges
Glassmorphic UI ❌ βœ… Premium frosted glass
Responsive Design βœ… Basic βœ… Optimized grid layout
Copy to Clipboard βœ… βœ… With fallback support
Auto TOC ❌ βœ… Dynamic generation
Form Validation ❌ βœ… Required field checks
Sample Data ❌ βœ… First-visit auto-load
Toast Notifications ❌ βœ… Success/error messages
Custom Fonts ❌ βœ… Google Fonts pairing
SVG Icons ❌ βœ… Inline professional icons
Debounced Input ❌ βœ… 1-second optimization

πŸ“± Responsive Design

Desktop (>1024px):

  • 2-column grid (form left, preview right)
  • Sticky preview panel
  • Full-width form inputs

Tablet (768px-1024px):

  • Single column stacked layout
  • Preview below form
  • Maintained input sizing

Mobile (<768px):

  • Full-width responsive layout
  • Reduced padding and margins
  • Optimized font sizes (2.5rem β†’ 1.8rem for title)
  • Stacked button groups
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr; /* Single column */
  }
  
  .preview-section {
    position: relative; /* Remove sticky */
    top: 0;
  }
}

@media (max-width: 768px) {
  header h1 {
    font-size: 1.8rem; /* Reduced from 3rem */
  }
  
  .button-group {
    flex-direction: column; /* Stack buttons */
  }
  
  .form-section,
  .preview-section {
    padding: 20px; /* Reduced from 35px */
  }
}

πŸš€ Future Enhancements

Potential features to add:

  • Markdown Templates: Pre-built templates for different project types (React, Node.js, Python, etc.).
  • Export as File: Download generated README.md directly instead of clipboard only.
  • Dark/Light Mode Toggle: Switch between glassmorphic dark and light themes.
  • Historical Saves: LocalStorage to save and reload previous README configurations.
  • GitHub API Integration: Auto-fetch repository details (stars, forks, contributors).
  • Live Markdown Syntax Highlighting: Code block syntax highlighting in preview.
  • Drag-and-Drop Section Ordering: Rearrange section order visually.
  • Image Upload: Direct image upload instead of URL-only for screenshots.
  • Multi-Language Support: Internationalization for non-English users.
  • Emoji Picker: Built-in emoji selector for section headings and features.
  • PDF Export: Generate PDF version of README for offline documentation.
  • Custom CSS Themes: User-uploadable theme files for personalization.

Contributions welcome β€” feel free to open issues or create PRs to add features like markdown templates, GitHub API integration, or export functionality.

Releases

No releases published

Packages

 
 
 

Contributors