Skip to content

fix: include nested callout content in html export#8738

Open
mturac wants to merge 1 commit into
AppFlowy-IO:mainfrom
mturac:fix/6537-callout-html-export
Open

fix: include nested callout content in html export#8738
mturac wants to merge 1 commit into
AppFlowy-IO:mainfrom
mturac:fix/6537-callout-html-export

Conversation

@mturac

@mturac mturac commented May 17, 2026

Copy link
Copy Markdown

Summary

  • include nested child blocks when rendering callout blocks to HTML
  • add a nested callout export fixture so callout paragraph content is preserved

Fixes #6537

Testing

  • rustfmt --check frontend/rust-lib/flowy-document/src/parser/parser_entities.rs frontend/rust-lib/flowy-document/tests/parser/parse_to_html_text/test.rs
  • git diff --check

Attempted but blocked locally:

  • cargo test -j1 -p flowy-document --test main parse_to_html_text::test::block_tests

The test build reached crate compilation but this fresh checkout is missing generated protobuf modules such as flowy-error/src/protobuf.rs, causing flowy-error to fail before the parser test target could run.

Summary by Sourcery

Ensure HTML export for callout blocks includes nested child content and add coverage for nested callout rendering.

Bug Fixes:

  • Include nested child blocks when exporting callout blocks to HTML so their content is preserved.

Tests:

  • Add nested callout HTML/text/json fixtures and include them in the parser HTML export test suite.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sourcery-ai

sourcery-ai Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the HTML export logic for callout blocks so that nested child blocks are included inside the

tag, and adds a new nested callout fixture wired into the existing parser HTML export tests.

Sequence diagram for updated callout HTML export with nested children

sequenceDiagram
    participant NestedBlock
    participant html_buffer as html
    participant convert_nested_block_children_to_html

    NestedBlock->>html_buffer: push_str(format!("<{}>{}{}", ASIDE_TAG_NAME, data.get_plain_text(), text_html))
    NestedBlock->>convert_nested_block_children_to_html: convert_nested_block_children_to_html(Arc::new(self.to_owned()))
    convert_nested_block_children_to_html-->>NestedBlock: nested_children_html
    NestedBlock->>html_buffer: push_str(&nested_children_html)
    NestedBlock->>html_buffer: push_str(format!("</{}>", ASIDE_TAG_NAME))
Loading

File-Level Changes

Change Details Files
Render nested children inside callout elements during HTML export.
  • Change callout HTML template to open the tag without immediately closing it
  • Append HTML for nested child blocks using convert_nested_block_children_to_html on the current NestedBlock
  • Append the closing tag after rendering both the icon/text and nested children
frontend/rust-lib/flowy-document/src/parser/parser_entities.rs
Add a nested callout regression test fixture to the HTML export tests.
  • Register a new callout_nested test case in the block_tests test suite
  • Add an HTML fixture verifying that nested callout content is preserved within the
  • Introduce placeholder JSON and text fixtures for the new callout_nested case
frontend/rust-lib/flowy-document/tests/parser/parse_to_html_text/test.rs
frontend/rust-lib/flowy-document/tests/assets/html/callout_nested.html
frontend/rust-lib/flowy-document/tests/assets/json/callout_nested.json
frontend/rust-lib/flowy-document/tests/assets/text/callout_nested.txt

Assessment against linked issues

Issue Objective Addressed Explanation
#6537 Ensure that callout blocks (including their inner content) are preserved and exported correctly in the generated HTML output instead of being dropped.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new callout_nested fixtures for JSON and text are currently empty files in the diff; if the test harness expects non-empty fixture content, consider populating them to avoid brittle or misleading test behavior.
  • In the CALLOUT branch, convert_nested_block_children_to_html(Arc::new(self.to_owned())) introduces an extra allocation and clone; if possible, adjust convert_nested_block_children_to_html to accept &NestedBlock (or reuse an existing Arc) to avoid this overhead.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `callout_nested` fixtures for JSON and text are currently empty files in the diff; if the test harness expects non-empty fixture content, consider populating them to avoid brittle or misleading test behavior.
- In the `CALLOUT` branch, `convert_nested_block_children_to_html(Arc::new(self.to_owned()))` introduces an extra allocation and clone; if possible, adjust `convert_nested_block_children_to_html` to accept `&NestedBlock` (or reuse an existing `Arc`) to avoid this overhead.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

[Bug] HTML export drops callouts

2 participants