Summary
Typed link source is never recognized as a link, which is consistent on its own, but the serializer only escapes it when it ends the paragraph. Followed by a space, the same typed source is written to the file unescaped, so reloading the document turns text the editor deliberately kept literal into a link. The transient state and the reloaded state disagree, and which one wins depends on a trailing space.
Steps to reproduce
- Open an empty document.
- Type
[test link](./test.html) and save. The saved source is escaped.
- Open another empty document.
- Type
[test link](./test.html), then type one space, and save.
- Reload the document.
Expected behavior
A typed source form reaches the same interpretation whether or not it is followed by a space, and the reloaded document matches the state the editor presented before the save.
Actual behavior
Measured against a61106a. None of these inputs is recognized while typing; the difference is what reaches the file:
| Typed |
Serialized result |
On reload |
[test link](./test.html) |
\[test link]\(./test.html) |
Literal text |
[test link](./test.html) |
[test link](./test.html) |
Inline link |
https://example.com |
https\://example.com |
Literal text |
https://example.com |
https://example.com |
Autolink literal |
<https://example.com> |
\<https\://example.com> |
Literal text |
<https://example.com> |
<https://example.com> |
URI autolink |
Plain-text paste recognizes all three forms immediately, and a pasted bare URL is rewritten to the angle-bracket form <https://example.com> rather than kept as the GFM autolink literal that was pasted.
Related context
- Related issues or pull requests: none
- Found through manual testing and revalidated against a61106a by driving the editor mount used by the plugin tests.
Done when
Out of scope
- Whether typing link source should create a link at all, matching plain-text paste. Decide that separately; this issue is about the two typed paths disagreeing with each other.
- Whether a pasted bare URL should keep its GFM autolink-literal form instead of being rewritten to angle brackets.
Summary
Typed link source is never recognized as a link, which is consistent on its own, but the serializer only escapes it when it ends the paragraph. Followed by a space, the same typed source is written to the file unescaped, so reloading the document turns text the editor deliberately kept literal into a link. The transient state and the reloaded state disagree, and which one wins depends on a trailing space.
Steps to reproduce
[test link](./test.html)and save. The saved source is escaped.[test link](./test.html), then type one space, and save.Expected behavior
A typed source form reaches the same interpretation whether or not it is followed by a space, and the reloaded document matches the state the editor presented before the save.
Actual behavior
Measured against a61106a. None of these inputs is recognized while typing; the difference is what reaches the file:
[test link](./test.html)\[test link]\(./test.html)[test link](./test.html)[test link](./test.html)https://example.comhttps\://example.comhttps://example.comhttps://example.com<https://example.com>\<https\://example.com><https://example.com><https://example.com>Plain-text paste recognizes all three forms immediately, and a pasted bare URL is rewritten to the angle-bracket form
<https://example.com>rather than kept as the GFM autolink literal that was pasted.Related context
Done when
Out of scope