Skip to content

Commit 970164a

Browse files
Fix markdown paste and reload fidelity
1 parent c3c3090 commit 970164a

8 files changed

Lines changed: 710 additions & 22 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Edge Cases Test Note
2+
3+
## Empty Lines Between Content
4+
5+
Paragraph one.
6+
7+
8+
Two blank lines above (should create one empty paragraph).
9+
10+
11+
12+
Three blank lines above (should create two empty paragraphs).
13+
14+
## Code Block With Special Characters
15+
16+
```html
17+
<div class="container" data-theme="dark">
18+
<h1>Hello & "World"</h1>
19+
<p>x < y && y > z</p>
20+
<img src="attachment://abc123.png" alt="test" />
21+
</div>
22+
```
23+
24+
## Code Block Without Language
25+
26+
```
27+
This is a plain code block
28+
with no language specified
29+
and some indentation
30+
```
31+
32+
## Inline Code With Special Chars
33+
34+
Use `<div class="foo">` for the container. The expression `x && y || z` is truthy. Access the value with `map["key"]`.
35+
36+
## Nested Formatting
37+
38+
This has **bold with *italic inside* it** and *italic with **bold inside** it*.
39+
40+
Here's ~~strikethrough with **bold** inside~~ and **bold with ~~strikethrough~~ inside**.
41+
42+
## Links and Images
43+
44+
Here's a [regular link](https://example.com) and a [link with title](https://example.com "Example Site").
45+
46+
![A test image](attachment://abc123def456.png)
47+
48+
## Blockquote
49+
50+
> This is a blockquote.
51+
> It spans multiple lines.
52+
>
53+
> And has a second paragraph.
54+
55+
## Horizontal Rule
56+
57+
Content above the rule.
58+
59+
---
60+
61+
Content below the rule.
62+
63+
## Hashtags
64+
65+
Regular #hashtag in a paragraph.
66+
67+
Don't create hashtags in `#inline-code` or in code blocks:
68+
69+
```css
70+
.color { background: #default; }
71+
#header { color: #333; }
72+
```
73+
74+
## Numbers and Special Patterns
75+
76+
Phone: 555-0123
77+
Price: $49.99
78+
Percentage: 85%
79+
Email-like: user@example.com
80+
Path: /usr/local/bin
81+
82+
## Long Paragraph
83+
84+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Edge Cases Test Note
2+
3+
## Empty Lines Between Content
4+
5+
Paragraph one.
6+
7+
8+
Two blank lines above (should create one empty paragraph).
9+
10+
11+
12+
Three blank lines above (should create two empty paragraphs).
13+
14+
## Code Block With Special Characters
15+
16+
```html
17+
<div class="container" data-theme="dark">
18+
<h1>Hello & "World"</h1>
19+
<p>x < y && y > z</p>
20+
<img src="attachment://abc123.png" alt="test" />
21+
</div>
22+
```
23+
24+
## Code Block Without Language
25+
26+
```
27+
This is a plain code block
28+
with no language specified
29+
and some indentation
30+
```
31+
32+
## Inline Code With Special Chars
33+
34+
Use `<div class="foo">` for the container. The expression `x && y || z` is truthy. Access the value with `map["key"]`.
35+
36+
## Nested Formatting
37+
38+
This has **bold with *italic inside* it** and *italic with **bold inside** it*.
39+
40+
Here's ~~strikethrough with **bold** inside~~ and **bold with ~~strikethrough~~ inside**.
41+
42+
## Links and Images
43+
44+
Here's a [regular link](https://example.com) and a [link with title](https://example.com "Example Site").
45+
46+
![A test image](attachment://abc123def456.png)
47+
48+
## Blockquote
49+
50+
> This is a blockquote.
51+
> It spans multiple lines.
52+
>
53+
> And has a second paragraph.
54+
55+
## Horizontal Rule
56+
57+
Content above the rule.
58+
59+
---
60+
61+
Content below the rule.
62+
63+
## Hashtags
64+
65+
Regular #hashtag in a paragraph.
66+
67+
Don't create hashtags in `#inline-code` or in code blocks:
68+
69+
```css
70+
.color { background: #default; }
71+
#header { color: #333; }
72+
```
73+
74+
## Numbers and Special Patterns
75+
76+
Phone: 555-0123
77+
Price: $49.99
78+
Percentage: 85%
79+
Email-like: user@example.com
80+
Path: /usr/local/bin
81+
82+
## Long Paragraph
83+
84+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

docs/markdown-fixtures/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Markdown Fixture Expectations
2+
3+
These are manual fixture expectations for Comet's markdown editor when the
4+
same note goes through different editor paths.
5+
6+
## `05-edge-cases`
7+
8+
There are two valid expected outputs for this fixture:
9+
10+
1. Immediate paste/copy round-trip
11+
12+
Use [05-edge-cases.immediate-paste.expected.md](/Users/chris/Repos/project/comet/docs/markdown-fixtures/05-edge-cases.immediate-paste.expected.md).
13+
14+
This covers:
15+
- paste markdown into Comet
16+
- copy it back out without navigating away from the note
17+
18+
Expectation:
19+
- bare email text copies back out as plain text
20+
- the editor may render the email as a link immediately on paste
21+
- current paste path uses frontend `marked` import rules
22+
23+
2. After reload / navigate away and back
24+
25+
Use [05-edge-cases.after-reload.expected.md](/Users/chris/Repos/project/comet/docs/markdown-fixtures/05-edge-cases.after-reload.expected.md).
26+
27+
This covers:
28+
- save note state
29+
- leave the note
30+
- reopen the note
31+
- copy/export again
32+
33+
Expectation:
34+
- bare email text still copies back out as plain text
35+
- the in-editor note may render the email as a link after reload because the
36+
current load path uses Rust `comrak` with autolink enabled
37+
38+
## UI-only expectation
39+
40+
For the blockquote in `05-edge-cases`, the editor must allow the caret to land
41+
on the blank quoted line between the two paragraphs. This is an editor-structure
42+
expectation, not a markdown diff expectation.

0 commit comments

Comments
 (0)