Summary
An image's alt text is held as a plain string, so anything structured inside it is destroyed when the file is opened and gone from the file after one save. Emphasis, inline code, and a nested image are all flattened to their text, and the loss is silent and permanent.
Unlike the other authored-form defects under #251, this is content loss rather than a rewrite: the markers and the inner image cannot be recovered from the saved file.
Steps to reproduce
- Open a document containing
`.
- Save it.
- Read the file.
Expected behavior
The alt text keeps the content the author wrote. CommonMark allows inline content inside an image description, and corpus/commonmark/links-and-images.md covers both forms.
Actual behavior
Measured against 9626471d by driving the editor mount used by the plugin tests. Both rows are stable across a second save, so the corpus guard is green on both:
| Document |
Saved |
` |
 |
](../assets/leaf.svg) |
 |
The second row destroys the inner image entirely; its destination is not in the saved file anywhere.
Related context
Done when
Notes, logs, screenshots
Diagnosis
The image node carries its description as an alt string attribute rather than as inline children, so the parse discards everything but the text. Both the corpus guard in src/features/editor/tests/corpusRoundTrip.test.tsx and the serializer are blind to it: the flattened form converges perfectly, which is exactly the failure mode #251 records under A green corpus guard does not mean a sub-issue worked.
Implementation direction
The image schema comes from @milkdown/preset-commonmark, so this is likely a local schema override in createMilkdownEditor.ts, which already carries that pattern for hardbreakSchema and linkSchema. #251 also records the trap that extendSchema registers a new slice, so an override on a schema reached that way never lands.
Nested images may be worth separating from the mark case once the schema question is answered; the mark case is the common one and the corpus covers it directly.
Out of scope
- Link labels, which already carry inline children and keep their formatting.
- The escaping and normalization differences in the same corpus file, which are filed on their own.
Summary
An image's alt text is held as a plain string, so anything structured inside it is destroyed when the file is opened and gone from the file after one save. Emphasis, inline code, and a nested image are all flattened to their text, and the loss is silent and permanent.
Unlike the other authored-form defects under #251, this is content loss rather than a rewrite: the markers and the inner image cannot be recovered from the saved file.
Steps to reproduce
`.Expected behavior
The alt text keeps the content the author wrote. CommonMark allows inline content inside an image description, and
corpus/commonmark/links-and-images.mdcovers both forms.Actual behavior
Measured against
9626471dby driving the editor mount used by the plugin tests. Both rows are stable across a second save, so the corpus guard is green on both:`](../assets/leaf.svg)The second row destroys the inner image entirely; its destination is not in the saved file anywhere.
Related context
corpus/commonmark/links-and-images.mdunderInline and reference image formsandLinked and nested images;docs/specification.mdInline Content.Done when
Notes, logs, screenshots
Diagnosis
The image node carries its description as an
altstring attribute rather than as inline children, so the parse discards everything but the text. Both the corpus guard insrc/features/editor/tests/corpusRoundTrip.test.tsxand the serializer are blind to it: the flattened form converges perfectly, which is exactly the failure mode #251 records underA green corpus guard does not mean a sub-issue worked.Implementation direction
The image schema comes from
@milkdown/preset-commonmark, so this is likely a local schema override increateMilkdownEditor.ts, which already carries that pattern forhardbreakSchemaandlinkSchema. #251 also records the trap thatextendSchemaregisters a new slice, so an override on a schema reached that way never lands.Nested images may be worth separating from the mark case once the schema question is answered; the mark case is the common one and the corpus covers it directly.
Out of scope