Skip to content

[pull] main from tinacms:main#186

Merged
pull[bot] merged 2 commits intocode:mainfrom
tinacms:main
Apr 16, 2026
Merged

[pull] main from tinacms:main#186
pull[bot] merged 2 commits intocode:mainfrom
tinacms:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Apr 16, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

isaaclombardssw and others added 2 commits April 16, 2026 01:55
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: JackDevAU <jpr178@live.com.au>
Co-authored-by: Jack Pettit [SSW] <57518417+JackDevAU@users.noreply.github.com>
…#6673)

## Summary

Fixes #6653

Code blocks with metadata in the infostring (the part after the language
identifier) were silently stripped on every save through TinaCMS. For
example:

**Before editing:**
````markdown
```js {1,3-5}
console.log('hello');
```
````

**After saving:**
````markdown
```js
console.log('hello');
```
````

The `{1,3-5}` was lost. Same issue for `title="app.py"` and any other
infostring metadata.

## Root cause

Three places all needed a one-line fix:

1. **Type** (`parse/plate.ts`) — `CodeBlockElement` had no `meta` field
2. **Parser** (`parse/remarkToPlate.ts`) — `meta` was read from the
mdast `Code` node but never forwarded to the Plate element
3. **Serializer** (`stringify/index.ts`) — only `lang` was written back
to the output mdast node; `meta` was dropped

## Changes

- Add `meta?: string` to `CodeBlockElement`
- Forward `content.meta` in the parser
- Emit `meta` in the serializer
- Add a round-trip test (`markdown-basic-code-block-meta`) covering
line-highlight syntax (`{1,3-5}`) and file-name annotation
(`title="app.py"`)

## Test plan

- [ ] Existing `markdown-basic-code-block` test still passes
- [ ] New `markdown-basic-code-block-meta` test passes (parse +
serialize round-trip)
- [ ] Manually verified with a `.md` file containing ` ```js {1,3-5} ` —
meta survives a TinaCMS save

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@pull pull Bot locked and limited conversation to collaborators Apr 16, 2026
@pull pull Bot added the ⤵️ pull label Apr 16, 2026
@pull pull Bot merged commit 55dae8e into code:main Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants