feat: Add percentage width support for two-column layouts#20
feat: Add percentage width support for two-column layouts#20orangewise merged 6 commits intomainfrom
Conversation
This commit adds the ability to specify custom width percentages for two-column layouts, allowing more flexible column sizing beyond the default 50/50 split. Changes: - Parser: Support `:::columns[60]` syntax to specify left column width - The right column automatically gets the remaining width - Backward compatible: `:::columns` still works for 50/50 split - Width is included in marker format: `<!-- COLUMN:LEFT:START:60 -->` - Frontend: Extract and apply width styles from markers - Parse width percentage from column markers - Apply inline flex styles for custom widths - Validate width is between 1-99% - Examples: Add four new example slides demonstrating the feature - Explanation slide for the syntax - 70/30 split example (wide main content + sidebar) - 60/40 split example (code review layout) - 30/70 split example (narrow left + wide right) - Tests: Add comprehensive unit tests - Test various percentage values (30%, 50%, 60%, 70%) - Test backward compatibility (columns without width) - Test integration with other features (notes, width modes) - Test multiple column blocks with different widths - Screenshots: Update capture script to include new examples - Add screenshots for 70/30 and 30/70 layouts - Will be generated automatically by GitHub Actions All 36 tests pass successfully.
Code Review: Custom Column Width Percentage FeatureSummaryThis PR adds custom width percentages for two-column layouts. Overall, this is a well-implemented feature with good test coverage and documentation. Strengths
Issues Found1. Width Validation Inconsistency (Minor)Location: markdeck/static/slides.js:306-307 The frontend validates width (1-99%), but the backend parser has NO validation. Users could write columns[150] and it would be accepted. Recommendation: Add validation in parser.py after line 121 2. Regex Doesn't Validate Width Format (Minor)Location: markdeck/parser.py:118 Pattern accepts columns[000060] or columns[9999]. Update pattern to limit to 1-99 range. 3. CSS Flex Behavior Could Be ClearerLocation: markdeck/static/slides.js:305-310 Right column relies on implicit flex calculation. Making it explicit would improve maintainability by calculating rightWidth = 100 - validWidth. Security and Performance
RecommendationsPriority High:
Priority Medium: Approval StatusAPPROVED with minor suggestions This is a high-quality PR that solves a real user need with excellent test coverage. The suggested improvements are minor and could be addressed in a follow-up PR. The core functionality is solid and ready to merge. Great work on this feature! Review conducted following CLAUDE.md guidelines |
|
Replace column_width_70_30.png with a screenshot of Custom Width Example: 30/70 Narrow Left Plus bump version and update the readme |
|
Claude finished @orangewise's task in 2m 35s —— View job All requested changes completed! ✅Task List
Changes Made
All changes have been committed and pushed to the PR branch. --- | |
…custom column widths Changes: - Update capture_screenshots.py to screenshot 30/70 slide for column_width_70_30.png - Bump version from 0.5.0 to 0.6.0 in pyproject.toml and __init__.py - Add comprehensive "Custom Column Widths" section to README - Update roadmap to mark custom column widths as complete Co-authored-by: Ronald Luitwieler <orangewise@users.noreply.github.com>
Code Review: Custom Column Width FeatureOverviewThis PR adds support for custom percentage-based column widths to the two-column layout feature. The implementation is well-designed, thoroughly tested, and ready to merge with a few minor suggestions below. ✅ Strengths1. Excellent Backward Compatibility
2. Comprehensive Test Coverage
3. Clean Implementation
4. Good Documentation
5. Proper Validation
🔍 Areas for Consideration1. Input Validation Gap
|
| Priority | Issue | Action | Effort |
|---|---|---|---|
| Medium | Parser validation | Add 1-99% range check with warning | 5-10 min |
| Low | Screenshot naming | Clarify naming convention in comment | 2 min |
| Optional | Documentation | Note about multiple column blocks | 5 min |
✨ Final Verdict
Status: ✅ Approved - Ready to Merge
This is a high-quality implementation that:
- Solves a real use case (asymmetric layouts)
- Maintains backward compatibility
- Has excellent test coverage
- Follows project conventions
- Includes documentation and examples
The suggestions above are optional refinements - the PR is production-ready as-is.
Recommendation: Merge now, optionally address parser validation in a follow-up PR.
🎉 Great Work!
Special kudos for:
- Thorough testing (8 new test cases!)
- Backward compatibility testing
- Real-world examples (code review, sidebar, stats)
- Clean, minimal code changes
Generated with Claude Code Review
|
Thanks, i think you missed this one "Replace column_width_70_30.png with a screenshot of Custom Width Example: 30/70 Narrow Left" |
|
Claude finished @orangewise's task in 1m 8s —— View job Screenshot Capture Fixed ✅Task List
Changes MadeFixed the slide navigation in
The GitHub Actions workflow will automatically regenerate the screenshot when it runs next. --- | Branch | Latest commit |
Navigate to slide 32 (not 31) to capture the 'Custom Width Example: 30/70 Narrow Left' slide for column_width_70_30.png. Co-authored-by: Ronald Luitwieler <orangewise@users.noreply.github.com>
Code Review: Add percentage width support for two-column layoutsSummaryThis is a well-implemented feature that adds custom width percentages to two-column layouts. The implementation is clean, backward compatible, and includes comprehensive test coverage. ✅ Strengths1. Clean Architecture
2. Excellent Test CoverageTests cover: percentage values (30%, 50%, 60%, 70%), backward compatibility, integration with notes/width modes, multiple column blocks, and edge cases. 3. Good DocumentationREADME updated with clear examples and use cases. Code comments explain transformation logic. 🔍 Issues & Concerns1. Missing Input Validation in Parser (Medium Priority)Location: markdeck/parser.py:119-136 The parser accepts any digit sequence without validation. Invalid values like :::columns[0], :::columns[100], or :::columns[999] pass through to frontend. Recommendation: Add validation after line 122 to check width is 1-99, fallback to default if invalid. 2. Silent Value Clamping (Low Priority)Location: markdeck/static/slides.js:307 Frontend silently clamps invalid values without warning. Consider adding console.warn() for values outside 1-99 range. 3. Screenshot Naming Confusion (Low Priority)Location: capture_screenshots.py:167 Comment says "Using 70_30 filename but showing 30/70 slide". Both column_width_30_70.png and column_width_70_30.png appear identical (same binary). Verify correct slides are captured. 🎯 Code QualityParser (Python):
Frontend (JavaScript):
Tests:
🔒 Security✅ No security concerns - values validated/clamped, no XSS risks, no injection risks ⚡ Performance✅ Minimal impact - efficient regex, O(1) validation, no extra DOM manipulation 📋 Recommendations
🎉 ConclusionHigh-quality PR with excellent test coverage and documentation. Identified issues are minor and don't block merging. Feature works correctly even with current validation. Recommendation: ✅ Approve with minor suggestions Great work on this feature! The 70/30 and 60/40 split examples are particularly useful for common presentation layouts. |
This commit adds the ability to specify custom width percentages for
two-column layouts, allowing more flexible column sizing beyond the
default 50/50 split.
Changes:
Parser: Support
:::columns[60]syntax to specify left column width:::columnsstill works for 50/50 split<!-- COLUMN:LEFT:START:60 -->Frontend: Extract and apply width styles from markers
Examples: Add four new example slides demonstrating the feature
Tests: Add comprehensive unit tests
Screenshots: Update capture script to include new examples
All 36 tests pass successfully.