Summary
A projected character reference replaces the character it names, so while the source is open the author reads © and no longer sees what it renders. For a reference the point of reading the source is to tell one form from another, and the character it produces is the thing being identified, so hiding it removes the answer the projection was opened to get. This is most acute for a reference naming something invisible: and ​ render as whitespace the author cannot otherwise confirm.
Typora shows both, drawing the rendered character followed by its source in a muted marker colour, and treats the character and the reference's opening & as one unit for deletion and character move.
Expected behavior
While a character reference is projected, the character it names is shown beside its source in the marker colour the projection already uses for syntax. The preview is presentation only: it is not document text, it takes no caret, it is not selected, copied, or saved, and every offset between the document and the file is unchanged by its presence.
The rule holds wherever a reference is projected, so the reference's own projection, a marked fragment holding one, and a link label holding one all present it the same way.
Related context
Done when
Notes
Implementation direction
createProjectionDecorations already builds a DecorationSet from the spans an adapter returns, all of which are Decoration.inline. A Decoration.widget holding the decoded character rides in the same set and touches neither the projected text nor the source maps, which is what keeps every offset intact. SourceProjectionPresentation carries only spans today and needs a way to express a widget.
Deciding this on the display side matters: were the character document text instead, a projected run would hold characters the file does not, and an edit would have to guess whether the author meant the preview or the source.
Out of scope
- Typora's deletion behaviour, where removing the character removes the reference's opening
&. Deletion is worth its own decision and depends on this landing first.
- Any change to what a projection commits or saves.
- A preview shown before the caret arrives, which is a marker-presentation concern rather than a projection one.
Summary
A projected character reference replaces the character it names, so while the source is open the author reads
©and no longer sees what it renders. For a reference the point of reading the source is to tell one form from another, and the character it produces is the thing being identified, so hiding it removes the answer the projection was opened to get. This is most acute for a reference naming something invisible: and​render as whitespace the author cannot otherwise confirm.Typora shows both, drawing the rendered character followed by its source in a muted marker colour, and treats the character and the reference's opening
&as one unit for deletion and character move.Expected behavior
While a character reference is projected, the character it names is shown beside its source in the marker colour the projection already uses for syntax. The preview is presentation only: it is not document text, it takes no caret, it is not selected, copied, or saved, and every offset between the document and the file is unchanged by its presence.
The rule holds wherever a reference is projected, so the reference's own projection, a marked fragment holding one, and a link label holding one all present it the same way.
Related context
docs/specification.mdInline Content, anddocs/decisions.mdunderAccept Milkdown GFM preset behavior.Done when
docs/specification.mdInline Content records the display rule, which currently states the opposite.Notes
Implementation direction
createProjectionDecorationsalready builds aDecorationSetfrom the spans an adapter returns, all of which areDecoration.inline. ADecoration.widgetholding the decoded character rides in the same set and touches neither the projected text nor the source maps, which is what keeps every offset intact.SourceProjectionPresentationcarries onlyspanstoday and needs a way to express a widget.Deciding this on the display side matters: were the character document text instead, a projected run would hold characters the file does not, and an edit would have to guess whether the author meant the preview or the source.
Out of scope
&. Deletion is worth its own decision and depends on this landing first.