Skip to content

Conversation

@eaglethrost
Copy link
Contributor

@eaglethrost eaglethrost commented Nov 10, 2025

PR App Fix RM-XYZ

🧰 Changes

If a callout starts with an html element, the content gets dropped when migrated. I found that this is because in migrate-callouts.ts, we are wrapping the first children in a heading, assuming the node has a children attribute, and putting the children under the heading. However, the node might be an HTML node (or could be others) that don't have children, as a result the value gets dropped.

Current approach to fix is to avoid wrapping the node entirely if it's not a paragraph since the others won't have children.

🧬 QA & Testing

// Use the migrate() function

const markdown = '> ⚠️ <div>hello</div>'
const mdx = migrate(markdown);

The mdx should retain the

hello
'

@eaglethrost eaglethrost marked this pull request as ready for review November 10, 2025 03:52
@eaglethrost eaglethrost marked this pull request as draft November 10, 2025 03:52
@eaglethrost eaglethrost marked this pull request as ready for review November 10, 2025 03:52
@kellyjosephprice kellyjosephprice merged commit bcb0c0a into readmeio:next Nov 11, 2025
2 checks passed
kellyjosephprice added a commit that referenced this pull request Nov 11, 2025
[![PR App][icn]][demo] | Fix RM-XYZ
:-------------------:|:----------:

## 🧰 Changes

- In readme-to-mdx.ts, do more type checking when checking if a node is
an h3 when visiting rdme-callout
- Part of the fix is also included in
#1230 where we skip wrapping
callout children in heading if it's empty

## 🧬 QA & Testing

- [Broken on production][prod].
- [Working in this PR app][demo].

---------

Co-authored-by: Kelly Joseph Price <[email protected]>
rafegoldberg pushed a commit that referenced this pull request Nov 11, 2025
## Version 11.7.0
### ✨ New & Improved

* migrate contents inside comments ([#1229](#1229)) ([60691dc](60691dc))

### 🛠 Fixes & Updates

* **deps:** bump tailwindcss from 4.1.16 to 4.1.17 ([#1231](#1231)) ([96343ae](96343ae)), closes [#19263](https://github.com/readmeio/markdown/issues/19263) [#19242](https://github.com/readmeio/markdown/issues/19242) [#19263](https://github.com/readmeio/markdown/issues/19263) [#19242](https://github.com/readmeio/markdown/issues/19242) [#19272](https://github.com/readmeio/markdown/issues/19272) [#19263](https://github.com/readmeio/markdown/issues/19263) [#19238](https://github.com/readmeio/markdown/issues/19238)
* empty callouts erroring out ([#1232](#1232)) ([e740bfc](e740bfc))
* extract sections within custom components for TOC ([#1227](#1227)) ([615fe1b](615fe1b))
* skip wrapping heading in callouts for non pragraph ([#1230](#1230)) ([bcb0c0a](bcb0c0a))
* **deps-dev:** upgrading to vitest v4 ([#1222](#1222)) ([4fbaa3e](4fbaa3e))

<!--SKIP CI-->
@rafegoldberg
Copy link
Contributor

This PR was released!

🚀 Changes included in v11.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants