decaporg / decaporg/decap-cms

Rich text preview omits block images nested in list items

Open
#7,898 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

## Describe the bug

Decap CMS 3.15.0 preserves block images nested in list items in the rich text editor after #7896, but the preview pane omits those images. The saved Markdown remains correct; this is a separate preview rendering issue.

## To reproduce

Use a rich text field containing:

```markdown
1. First step.
2. Last step.

![Screenshot](/img/screenshot.png)
```

The editor displays the image under the second list item, but the preview shows only the list text.

## Expected behavior

The preview renders the image under the second list item.

## Root cause

`remarkRehypeShortcodes` only transforms shortcodes among the root node children. The built-in image component is represented as a shortcode, so an image nested under `list > listItem` reaches `remark-rehype` untransformed and is dropped from the preview output.

## Version

Decap CMS 3.15.0

Contributor guide

Open the contributing guide

Research direction

Start by locating `remarkRehypeShortcodes` in the rich text preview pipeline and trace how `remark-rehype` handles nodes nested under `list > listItem`. Verify the reproduction with a block image inside a list item; done means the preview renders that image while saved Markdown remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.