Commit graph

5 commits

Author SHA1 Message Date
7ac0fc1c91 fix: Filter out script/style tags during DOM tree build
Some checks are pending
Build and Release / build (linux, ubuntu-latest) (push) Waiting to run
Build and Release / build (macos, macos-latest) (push) Waiting to run
Build and Release / release (push) Blocked by required conditions
Previously, script and style tags were only filtered during render,
but their text content (JavaScript code) was still in the DOM tree.
Now we skip these tags entirely during DOM tree construction,
resulting in much cleaner output for modern websites.
2025-12-27 18:24:23 +08:00
2878b42d36 refactor: Consolidate v2 architecture into main codebase
- Merge browser_v2 implementation into browser.cpp
- Remove deprecated files: browser_v2.cpp/h, main_v2.cpp, text_renderer.cpp/h
- Simplify CMakeLists.txt to build single 'tut' executable
- Remove test HTML files no longer needed
- Add stb_image.h for image support
2025-12-27 17:59:05 +08:00
c6b1a9ac41 feat: Add image ASCII art rendering support
- Add image data storage in DomNode for decoded images
- Collect image nodes in DocumentTree during parsing
- Download and decode images in browser_v2 before layout
- Render images as colored ASCII art using True Color
- Use stb_image for PNG/JPEG/GIF/BMP decoding (requires manual download)
- Fall back to placeholder for failed/missing images
2025-12-27 14:06:21 +08:00
d80d0a1c6e feat: Implement TUT 2.0 with new rendering architecture
Major features:
- New modular architecture with Terminal, FrameBuffer, Renderer layers
- True Color (24-bit) support with warm, eye-friendly color scheme
- Unicode support with proper CJK character width handling
- Differential rendering for improved performance
- Page caching (LRU, 20 pages, 5-minute expiry)
- Search functionality with highlighting (/, n/N)
- Form rendering (input, button, checkbox, radio, select)
- Image placeholder support ([alt text] or [Image: filename])
- Binary data download via fetch_binary()
- Loading state indicators

New files:
- src/browser_v2.cpp/h - Browser with new rendering system
- src/main_v2.cpp - Entry point for tut2
- src/render/* - Terminal, FrameBuffer, Renderer, Layout, Image modules
- src/utils/unicode.cpp/h - Unicode handling utilities
- tests/* - Test programs for each module

Build with: cmake --build build_v2
Run: ./build_v2/tut2 [URL]
2025-12-26 14:56:17 +08:00
0ecedb1aed feat: Add DOM tree implementation and fix compiler warnings
Major improvements:
- Add proper DOM tree structure (dom_tree.cpp/h) with hierarchical node representation
- Refactor HTML parser to use DOM tree instead of flat ContentElement structure
- Enhance text renderer with improved inline content handling and UTF-8 support
- Improve browser interactive element tracking with byte-accurate positioning
- Add comprehensive HTML entity decoding (80+ named entities + numeric)
- Enhance form handling with better field tracking and submission

Code quality improvements:
- Fix all compiler warnings (unused parameters/variables)
- Clean build with zero warnings
- Better separation of concerns between parsing and rendering

Testing:
- Add test_table.html for table rendering verification

This change enables better handling of complex HTML structures while
maintaining the Unix philosophy of simplicity and focus.
2025-12-25 13:18:08 +08:00