Skip to content

Commit 310ea73

Browse files
Version Packages
1 parent 20bcfaa commit 310ea73

35 files changed

Lines changed: 166 additions & 89 deletions

.changeset/escape-markdown-text.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

.changeset/keyless-numeric-path-segments.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/mint-keys-for-unusable-keys.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/schedule-keyless-children-normalization.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/soft-breaks-parse-soft.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/editor/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 8.1.3
4+
5+
### Patch Changes
6+
7+
- [#3235](https://github.com/portabletext/editor/pull/3235) [`53f24a9`](https://github.com/portabletext/editor/commit/53f24a9256dfa6a48adde302e67213afe03b5cfb) Thanks [@christianhg](https://github.com/christianhg)! - fix: keep numeric path segments for keyless nodes in resolved paths
8+
9+
Paths returned by `getNode`, `getChildren`, and `getAncestors` now carry the numeric sibling index for a node without a usable `_key`, instead of a fabricated `{_key: undefined}` segment that cannot distinguish keyless siblings. Repairs and edits addressing keyless nodes now always target the right node, including keyless children nested under keyless parents, and the patches they emit address the same numeric position.
10+
11+
- [#3232](https://github.com/portabletext/editor/pull/3232) [`73dd0e3`](https://github.com/portabletext/editor/commit/73dd0e3f5b97b06ea95aa77be914e908d8504a75) Thanks [@christianhg](https://github.com/christianhg)! - fix: mint keys for empty-string and non-string `_key` values, not just `undefined`
12+
13+
A child carrying `_key: ''` or a non-string `_key` now gets a fresh key minted by normalization, the same repair a child with no `_key` at all already received. Previously such keys were kept as-is, leaving nodes the editor could not reliably address. When several keyless siblings arrive at once, each now receives its own distinct key instead of the first sibling absorbing every mint.
14+
15+
- [#3232](https://github.com/portabletext/editor/pull/3232) [`f80ab9f`](https://github.com/portabletext/editor/commit/f80ab9fe59c817b8b54e2d54478056e52c24cdfd) Thanks [@christianhg](https://github.com/christianhg)! - fix: schedule keyless children from a wholesale set for key-mint normalization
16+
17+
Blocks or children that arrive without a `_key` through a whole-array `set` patch are now repaired: normalization mints a key for every keyless child and emits the corresponding `set` patches. Previously such children were skipped when collecting normalization work, so they stayed keyless in the editor and any edit addressing them could not target the document.
18+
319
## 8.1.2
420

521
### Patch Changes

packages/editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@portabletext/editor",
3-
"version": "8.1.2",
3+
"version": "8.1.3",
44
"description": "Portable Text Editor made in React",
55
"keywords": [
66
"collaborative",

packages/markdown/CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,56 @@
11
# @portabletext/markdown
22

3+
## 2.0.1
4+
5+
### Patch Changes
6+
7+
- [#3183](https://github.com/portabletext/editor/pull/3183) [`0da0721`](https://github.com/portabletext/editor/commit/0da07219dc83b0cb7b545a45519b2c62c7b70737) Thanks [@christianhg](https://github.com/christianhg)! - fix: escape markdown syntax in plain span text during serialization
8+
9+
If your Portable Text contains text that happens to look like markdown, converting it to markdown and back used to corrupt it: the punctuation was read as formatting instead of text. `portableTextToMarkdown` now backslash-escapes such text, so it comes back as exactly the text it was.
10+
11+
```ts
12+
// span text markdown (before) markdown (now) re-parses as
13+
'*bar*' // *bar* \*bar\* the text `*bar*` (was: an emphasized span reading `bar`)
14+
'# heading' // # heading \# heading the text `# heading` (was: an `h1` block)
15+
'[x]: y' // [x]: y \[x]: y the text `[x]: y` (was: nothing, the line vanished)
16+
```
17+
18+
This works wherever the text sits (headings, blockquotes, list items, table cells) and also when the risky characters are split across neighboring spans. The visible change in your output: markdown for text containing such punctuation gains backslashes it didn't have before. It pastes and parses like any hand-written markdown.
19+
20+
Text with the `code` decorator is never backslash-escaped. Its backtick delimiters widen instead, so the content survives verbatim even when it contains backticks:
21+
22+
```ts
23+
// span text with the `code` decorator markdown (before) markdown (now)
24+
'a`b' // `a`b` (broken) ``a`b``
25+
'`a' // ``a` (broken) `` `a ``
26+
```
27+
28+
If you supply custom mark or block renderers: `children` now arrives pre-escaped. When you need the original text, read the `text` argument instead (the built-in `code` renderer does exactly that).
29+
30+
Two things stay as they were. A URL with an explicit scheme (`https://…`) or an email address is not escaped: it keeps its text and simply becomes a link on the next parse. A `www.`-style address is only left alone while it contains no markdown punctuation; with it, it gets escaped like ordinary text, and the round trip keeps every character either way. And leading or trailing whitespace that markdown itself trims still trims, same as before this change.
31+
32+
- [#3234](https://github.com/portabletext/editor/pull/3234) [`452fdbe`](https://github.com/portabletext/editor/commit/452fdbea5dfd8a04ced66a8e297e50b5c8c8260c) Thanks [@christianhg](https://github.com/christianhg)! - fix: parse markdown soft breaks as spaces, not line breaks
33+
34+
Markdown written across several source lines, the way editors and prose tools wrap text, is one paragraph that reflows. `markdownToPortableText` used to bake each of those wraps into the text as a literal newline, exactly as if you had written a hard break, and converting back to markdown then produced real hard breaks that weren't in your document.
35+
36+
Wrapped source like this:
37+
38+
```md
39+
This paragraph is written
40+
across two source lines.
41+
```
42+
43+
used to parse to the span text `'This paragraph is written\nacross two source lines.'` (a fixed line break in the content) and now parses to `'This paragraph is written across two source lines.'` (one reflowing line, which is how markdown renders it).
44+
45+
Real hard breaks are unchanged: end a line with two or more spaces, or a backslash, and the span text still gets a `\n`:
46+
47+
```md
48+
Line one\
49+
Line two
50+
```
51+
52+
still parses to `'Line one\nLine two'`.
53+
354
## 2.0.0
455

556
### Major Changes

packages/markdown/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@portabletext/markdown",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Convert Portable Text to and from Markdown",
55
"keywords": [
66
"markdown",

packages/plugin-character-pair-decorator/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 9.0.8
4+
5+
### Patch Changes
6+
7+
- Updated dependencies []:
8+
- @portabletext/plugin-input-rule@7.0.8
9+
310
## 9.0.7
411

512
### Patch Changes

0 commit comments

Comments
 (0)