Skip to content

Conversation

@strawmelonjuice
Copy link
Collaborator

@strawmelonjuice strawmelonjuice commented Jul 10, 2025

Summary by CodeRabbit

  • New Features

    • Introduced improved rendering for ordered lists, tables, blockquotes, and task lists, ensuring more consistent and robust HTML output.
    • Added a new out-of-the-box example index page with diverse markdown elements for enhanced initial content.
    • Enhanced support for links within tasks, blockquotes, and ordered lists.
  • Bug Fixes

    • Standardized styling and structure for blockquotes and task items for better visual consistency.
  • Tests

    • Added new tests to verify correct rendering of links in preprocessed items, ordered lists with links, and the default index page.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 10, 2025

Walkthrough

The changes introduce improved preprocessing and rendering for Djot markdown extensions, including robust handling of ordered lists, tables, blockquotes, and task lists. New test cases and snapshot files are added to verify the output. The out-of-the-box index content is centralized as a shared constant, and configuration now references this constant for initialization.

Changes

File(s) Change Summary
cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/djotparse.gleam Refactored Djot preprocessing: added dedicated ordered list preprocessing, improved table detection and conversion, changed blockquote and task list rendering to use nested Djot conversion, and removed inline ordered list detection from paragraph rendering. Added and updated several helper functions.
cynthia_websites_mini_client/birdie_snapshots/djot_with_preprocessing_test.accepted Updated HTML snapshot: task items now wrap text in <span><p>, checkbox attribute order standardized, and blockquotes use <p> instead of <pre>.
cynthia_websites_mini_client/birdie_snapshots/links_in_preprocessed_items_test.accepted Added snapshot test for task lists and blockquotes containing links, verifying correct HTML structure and styling.
cynthia_websites_mini_client/birdie_snapshots/ootb_index_rendering_test.accepted Added snapshot for out-of-the-box index page rendering, including headings, lists, images, blockquotes, code blocks, and tables with styling.
cynthia_websites_mini_client/birdie_snapshots/ordered_list_with_links_test.accepted Added snapshot test for ordered lists with links and inline formatting, verifying correct HTML output.
cynthia_websites_mini_client/test/cynthia_websites_mini_client_test.gleam Added three new test functions covering links in preprocessed items, ordered lists with links, and out-of-the-box index rendering.
cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam Replaced inline markdown for the index page with a reference to the new shared constant ootb_index.
cynthia_websites_mini_shared/src/cynthia_websites_mini_shared/configtype.gleam Added public constant ootb_index containing sample markdown for the default index page.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DjotParser
    participant Preprocessor
    participant Renderer

    User->>DjotParser: Submit markdown input
    DjotParser->>Preprocessor: Preprocess input (tables, ordered lists, tasks)
    Preprocessor->>Preprocessor: Detect and convert tables
    Preprocessor->>Preprocessor: Detect and convert ordered lists
    Preprocessor->>Preprocessor: Detect and convert task lists
    Preprocessor->>DjotParser: Return preprocessed markdown
    DjotParser->>Renderer: Parse and convert to HTML
    Renderer->>User: Output rendered HTML
Loading

Possibly related PRs

  • Implementing #28 Djot support #33: Added initial Djot preprocessing and rendering support, which is directly extended and refactored in this PR for improved handling of lists, tables, and blockquotes.

Poem

In the garden of code where Djot lines grow,
Lists now line up, and tables just flow.
Blockquotes and tasks, all neat and precise,
With snapshots and tests, the output looks nice!
Out-of-the-box index, a markdown delight—
🐇 Cheers to the changes, all rendered just right!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/djotparse.gleam (1)

520-642: Significant improvement in table processing robustness.

The rewritten table conversion logic is much more robust with:

  • Proper separator line detection using character analysis
  • Support for multiple header lines
  • Nested Djot content in cells via entry_to_conversion

However, consider adding validation to ensure all rows have a consistent number of columns to prevent rendering issues with malformed tables.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c8a204 and c0265ec.

📒 Files selected for processing (8)
  • cynthia_websites_mini_client/birdie_snapshots/djot_with_preprocessing_test.accepted (1 hunks)
  • cynthia_websites_mini_client/birdie_snapshots/links_in_preprocessed_items_test.accepted (1 hunks)
  • cynthia_websites_mini_client/birdie_snapshots/ootb_index_rendering_test.accepted (1 hunks)
  • cynthia_websites_mini_client/birdie_snapshots/ordered_list_with_links_test.accepted (1 hunks)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/djotparse.gleam (8 hunks)
  • cynthia_websites_mini_client/test/cynthia_websites_mini_client_test.gleam (2 hunks)
  • cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (1 hunks)
  • cynthia_websites_mini_shared/src/cynthia_websites_mini_shared/configtype.gleam (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: strawmelonjuice
PR: CynthiaWebsiteEngine/Mini#33
File: cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam:896-899
Timestamp: 2025-07-10T13:40:49.876Z
Learning: In CynthiaWebsiteEngine Mini, the user prefers to avoid requiring external dependencies like Pandoc during initial setup to maintain a smooth out-of-the-box experience, even if it means accepting some compatibility risks with Markdown/Djot parsing differences.
cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (1)
Learnt from: strawmelonjuice
PR: CynthiaWebsiteEngine/Mini#33
File: cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam:896-899
Timestamp: 2025-07-10T13:40:49.876Z
Learning: In CynthiaWebsiteEngine Mini, the user prefers to avoid requiring external dependencies like Pandoc during initial setup to maintain a smooth out-of-the-box experience, even if it means accepting some compatibility risks with Markdown/Djot parsing differences.
cynthia_websites_mini_client/birdie_snapshots/djot_with_preprocessing_test.accepted (1)
Learnt from: strawmelonjuice
PR: CynthiaWebsiteEngine/Mini#33
File: cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam:896-899
Timestamp: 2025-07-10T13:40:49.876Z
Learning: In CynthiaWebsiteEngine Mini, the user prefers to avoid requiring external dependencies like Pandoc during initial setup to maintain a smooth out-of-the-box experience, even if it means accepting some compatibility risks with Markdown/Djot parsing differences.
cynthia_websites_mini_client/test/cynthia_websites_mini_client_test.gleam (1)
Learnt from: strawmelonjuice
PR: CynthiaWebsiteEngine/Mini#33
File: cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam:896-899
Timestamp: 2025-07-10T13:40:49.876Z
Learning: In CynthiaWebsiteEngine Mini, the user prefers to avoid requiring external dependencies like Pandoc during initial setup to maintain a smooth out-of-the-box experience, even if it means accepting some compatibility risks with Markdown/Djot parsing differences.
🔇 Additional comments (11)
cynthia_websites_mini_shared/src/cynthia_websites_mini_shared/configtype.gleam (1)

160-209: Well-structured out-of-the-box content constant.

The ootb_index constant provides comprehensive test coverage for Djot markdown features including headings with IDs, lists, images, blockquotes, task lists, code blocks, and tables. This centralizes the default content and improves maintainability.

cynthia_websites_mini_client/birdie_snapshots/djot_with_preprocessing_test.accepted (1)

14-16: Improved HTML structure for task items and blockquotes.

The changes standardize content wrapping by using <span><p> elements for task items and <p> elements for blockquotes instead of raw text or <pre> tags. This provides more consistent styling and better semantic markup.

cynthia_websites_mini_client/birdie_snapshots/ordered_list_with_links_test.accepted (1)

1-9: Comprehensive test coverage for ordered lists with inline formatting.

The snapshot correctly validates ordered list rendering with embedded links and bold text formatting. The HTML structure uses semantic elements and proper CSS classes for styling.

cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (1)

919-919: Good refactoring to use centralized constant.

Replacing the inline content with configtype.ootb_index improves maintainability and ensures consistency between the default configuration and test cases.

cynthia_websites_mini_client/birdie_snapshots/links_in_preprocessed_items_test.accepted (1)

1-11: Targeted test coverage for links in preprocessed content.

The snapshot validates proper link rendering within task items and blockquotes, ensuring that the preprocessing pipeline correctly handles inline links while maintaining semantic HTML structure and consistent styling.

cynthia_websites_mini_client/birdie_snapshots/ootb_index_rendering_test.accepted (1)

1-63: LGTM! Well-structured test snapshot.

The snapshot properly captures the expected HTML output with appropriate styling classes, accessibility attributes, and semantic markup. The structure aligns well with the Djot preprocessing improvements mentioned in the PR.

cynthia_websites_mini_client/test/cynthia_websites_mini_client_test.gleam (1)

3-3: Good test coverage for the Djot preprocessing improvements.

The new tests appropriately cover the key scenarios:

  • Links within preprocessed elements (task lists, blockquotes)
  • Ordered lists with embedded formatting
  • Rendering of the centralized ootb_index content

Tests follow the established patterns and will help catch regressions.

Also applies to: 63-85

cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/djotparse.gleam (4)

40-45: Good reordering of preprocessing pipeline.

Moving table preprocessing before autolinks prevents autolinks from interfering with table structure. The addition of ordered list preprocessing as a separate step improves separation of concerns.


89-105: Clean simplification of paragraph handling.

Removing the ordered list detection logic from here is appropriate since ordered lists are now handled in the preprocessing phase. This improves code clarity and maintainability.


728-728: Excellent improvement for nested content support.

Using entry_to_conversion for blockquote and task list content enables proper rendering of nested Djot elements (links, formatting, etc.) instead of just raw text. This significantly improves the flexibility and correctness of the rendering.

Also applies to: 753-753, 773-773


816-885: Well-implemented ordered list preprocessing.

The new dedicated preprocessing for ordered lists is a clean improvement:

  • Clear pattern matching for numbered items
  • Proper handling of contiguous list blocks
  • Support for nested Djot content in list items
  • Better separation of concerns from paragraph processing

@strawmelonjuice strawmelonjuice merged commit 2ab977b into main Jul 10, 2025
9 checks passed
@strawmelonjuice strawmelonjuice deleted the fix-inlines branch August 10, 2025 12:15
@coderabbitai coderabbitai bot mentioned this pull request Aug 11, 2025
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.

2 participants