Skip to content

feat: list group builder - #124

Open
ContextFound wants to merge 13 commits into
Infinitix-LLC:mainfrom
ContextFound:feature/list-group-builder
Open

feat: list group builder#124
ContextFound wants to merge 13 commits into
Infinitix-LLC:mainfrom
ContextFound:feature/list-group-builder

Conversation

@ContextFound

Copy link
Copy Markdown

Summary

Adds a new ListGroupMd component that captures consecutive unordered list items as a single block, enabling custom group rendering (e.g., ReorderableListView for drag-to-reorder support). Primarily aimed at being able to make re-orderable lists from standard markdown list items.

image

Screen capture is from gpt_markdown_viewer created just to visualize the output of gpt_markdown. It has custom components and handling to utilize the ListGroupMd enhancement.

Changes

  • New types in markdown_config.dart:

    • ListGroupItem class with index, rawText, and content fields
    • ListGroupBuilder typedef for custom list group rendering
  • New listGroupBuilder parameter added to GptMarkdown and GptMarkdownConfig

  • New ListGroupMd block component that:

    • Matches 2+ consecutive unordered list items (single items still use UnOrderedList)
    • Calls listGroupBuilder when provided, passing the parsed items
    • Falls back to existing per-item rendering when listGroupBuilder is null

- Add custom stable serializer for widget tree comparison (test/utils/serializer.dart)
- Add test helpers: pumpMarkdown, expectMarkdown, expectMarkdownContains (test/utils/test_helpers.dart)
- Add inline element tests: bold, italic, strikethrough, underline, highlight, links
- Add block element tests: headings, lists, code blocks, tables, checkboxes, radio buttons, blockquotes, horizontal rules, indentation
- Add LaTeX tests: inline and block math expressions
- Add image tests with dimension support
- Add regression test folder structure for bug reproduction tests
- Add test framework documentation (test/README.md)

The serializer produces stable, comparable string output that avoids brittle widget equality checks. Tests verify both structural output and widget rendering.

All 123 tests pass.
failing tests in /bugs to identify known bugs
once fixed, move to /regression
test/README outlining approach
complex integration test added
serializer fix to render internal text
two known link rendering bugs identified, but currently skipped
- Pass url parameter to LinkButton constructor in ATagMd.build()
- Update link regex to support optional title attribute: [text](url "title")
- Update URL extraction logic to strip title portion from raw URL

Includes test infrastructure and regression tests to prevent recurrence.
- Introduced CheckBoxBuilder and RadioButtonBuilder types for custom rendering of checkboxes and radio buttons in GptMarkdown.
- Updated GptMarkdownConfig to include new builder properties.
- Modified CheckBoxMd and RadioButtonMd to utilize the new builders, allowing for flexible UI customization.
- Added comprehensive tests to validate the functionality of the new builders and their integration with GptMarkdown.
Replace initState() with didChangeDependencies() in lib/md_widget.dart
Add optional showFrontmatter parameter (default: true) to GptMarkdown
widget and GptMarkdownConfig. When set to false, YAML frontmatter blocks
at the beginning of markdown content are stripped before rendering.

Frontmatter format:
---
key: value
tags: ["active"]
---

- Added showFrontmatter to GptMarkdownConfig with copyWith and isSame
- Added showFrontmatter to GptMarkdown widget
- Implemented _stripFrontmatter static method with regex pattern
- Added comprehensive tests including edge cases:
  - Frontmatter-style blocks in middle of content are preserved
  - Only frontmatter at the very beginning is stripped
- Introduced ListGroupMd component to handle grouped unordered list items in GptMarkdown.
- Added ListGroupItem class to represent individual list items with content and index.
- Updated GptMarkdown and GptMarkdownConfig to include a listGroupBuilder for custom rendering of grouped lists.
- Enhanced the serializer to accommodate new widget structures.
@ContextFound ContextFound changed the title Feature/list group builder Feature: list group builder Jan 20, 2026
@ContextFound ContextFound changed the title Feature: list group builder feat: list group builder Jan 20, 2026
@masfour7
masfour7 requested a review from saminsohag June 16, 2026 16:16
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.

1 participant