Skip to content

Add comprehensive sample repository with examples demonstrating Midashi usage#57

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-12
Draft

Add comprehensive sample repository with examples demonstrating Midashi usage#57
Copilot wants to merge 3 commits intomainfrom
copilot/fix-12

Conversation

Copy link

Copilot AI commented Jul 16, 2025

This PR adds a comprehensive sample repository to demonstrate various usage patterns of the Midashi library for automatic heading hierarchy management.

What's Added

Sample Directory (/sample/)

  • SimpleExample.tsx - Basic usage showing automatic heading progression (h1→h2→h3→h4)
  • WebsiteExample.tsx - Realistic website layout converted from the original issue code with proper Midashi components
  • ComprehensiveExample.tsx - Advanced patterns showcasing custom components using useCurrentLevel() and useNextLevel() hooks
  • OriginalBrokenExample.tsx - Educational comparison showing problems that Midashi solves
  • README.md - Detailed documentation with usage patterns and integration examples
  • index.ts - Convenient exports for all examples

Key Improvements from Original Issue Code

  • Fixed all classnameclassName attribute issues
  • Converted manual heading hierarchy to automatic Midashi management
  • Proper semantic structure using all Midashi components (Header, Nav, Main, Section, Article, Aside, Footer)
  • Added comprehensive test coverage (/test/sample.test.tsx)

Examples Demonstrate

  1. Automatic Heading Hierarchy: How components automatically determine their heading level based on nesting
  2. Semantic HTML Integration: Using Midashi wrappers for semantic elements
  3. Custom Components: Building reusable components with Midashi hooks
  4. Real-world Patterns: Typical website layouts with proper document structure

Example Usage

import { Main, Section, H } from 'midashi';

function App() {
  return (
    <>
      <H>Page Title</H>           {/* Renders as h1 */}
      <Main>
        <H>Main Content</H>       {/* Renders as h2 */}
        <Section>
          <H>First Section</H>    {/* Renders as h3 */}
        </Section>
      </Main>
    </>
  );
}

Testing

  • All examples include comprehensive test coverage
  • Tests verify proper HTML structure and heading hierarchy
  • 40 total tests passing (33 existing + 7 new)

Documentation

  • Updated main README.md to reference the sample directory
  • Each example includes detailed comments explaining the features
  • Sample README provides integration patterns for popular frameworks

Fixes #12.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 16, 2025 12:37
Co-authored-by: bmthd <81406938+bmthd@users.noreply.github.com>
Co-authored-by: bmthd <81406938+bmthd@users.noreply.github.com>
Copilot AI changed the title [WIP] Add sample repository Add comprehensive sample repository with examples demonstrating Midashi usage Jul 16, 2025
Copilot AI requested a review from bmthd July 16, 2025 12:46
Copilot finished work on behalf of bmthd July 16, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add sample repository

2 participants