feat: implement index page generation for HTML directories - Issue #136

Complete TDD8 implementation of index page generation functionality:

Core Features:
- HTML file discovery with optional recursive search (find_html_files)
- Smart title extraction from <title>, <h1>, or filename (extract_html_title)
- Template-integrated index page generation (generate_index_html)
- CLI command 'md-index' with output, template, and recursive options
- Comprehensive error handling for edge cases and malformed files

Implementation Details:
- Reuses existing TEMPLATE_STYLES for consistent styling across all templates
- Proper relative path resolution for cross-directory navigation
- Modular design with helper functions for maintainability
- HTML parsing patterns extracted as module-level constants for performance

Tests: 23 comprehensive tests covering discovery, generation, CLI integration, and edge cases
Files: markitect/plugins/builtin/markdown_commands.py, tests/test_issue_136_index_generation.py
Status: All tests passing, full TDD8 cycle completed (RED→GREEN→REFACTOR→DOCUMENT)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-07 13:33:39 +02:00
parent 98fe3361af
commit 3b5d6eecda
4 changed files with 1026 additions and 2 deletions

68
README.html Normal file
View File

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>README</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
line-height: 1.6;
max-width: 800px;
margin: 0 auto;
padding: 20px;
color: #333;
}
#markdown-content {
margin: 0;
}
h1, h2, h3, h4, h5, h6 {
color: #2c3e50;
}
pre {
background-color: #f4f4f4;
padding: 15px;
border-radius: 5px;
overflow-x: auto;
}
code {
background-color: #f4f4f4;
padding: 2px 4px;
border-radius: 3px;
}
blockquote {
border-left: 4px solid #ddd;
margin: 0;
padding-left: 20px;
color: #666;
}
</style>
</head>
<body>
<div id="markdown-content"></div>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
// Embedded markdown payload
const markdownContent = "MarkiTect - Advanced Markdown Engine\n\nYour Markdown, Redefined.\n\nMarkiTect transforms markdown from plain text into intelligent, structured data with performance optimization, schema validation, and relational querying capabilities. Stop treating documentation as text files\u2014start managing it as a database.\n\n**Key Features:**\n- **Lightning Performance**: 60-85% faster document processing through intelligent AST caching\n- **Schema Validation**: Enforce document structure and consistency\n- **Database Integration**: Query markdown content with SQL-like operations\n- **CLI Tools**: Complete command-line interface for automation and workflows\n\n## \ud83d\udcda Documentation\n\n**Quick Start:** [Getting Started](#getting-started) \u00b7 [Command Reference](docs/user-guides/cache-management.md)\n\n**Architecture:** [Caching System](docs/architecture/caching-system.md) \u00b7 [Performance Philosophy](docs/#performance-philosophy)\n\n**Development:** [TDD Workflow](docs/development/tdd-workflow.md) \u00b7 [Contributing](#contributing)\n\n**Project Status:** [Current Status](history/ProjectStatusDigest.md) \u00b7 [Roadmap](history/ROADMAP.md) \u00b7 [Next Actions](NEXT.md)\n";
const frontMatter = {};
// Render markdown on page load
document.addEventListener('DOMContentLoaded', function() {
if (typeof marked !== 'undefined') {
document.getElementById('markdown-content').innerHTML = marked.parse(markdownContent);
} else {
// Fallback if marked.js fails to load
document.getElementById('markdown-content').innerHTML =
'<pre>' + markdownContent.replace(/</g, '&lt;').replace(/>/g, '&gt;') + '</pre>';
}
});
</script>
</body>
</html>