-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape roundtrip #366
Merged
Merged
Escape roundtrip #366
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1f76cbf
Escape markdown -> rich text. TODO: other way
threefjefff dbefff6
Catch any existing `escape` blocks, or catch and escape on parse
threefjefff 9ba6f9a
chore(lint): cleaning up vestigial dev nonsense
threefjefff 8c7a3e0
Apply formatting
dancormier 5942fc4
Escape tests, roundtrip tests
threefjefff 67d3ad1
Linting
threefjefff 25fe874
`escape` isn't as cut and dry, so be specific in our operations
threefjefff d4fc55f
The linting just does not stop
threefjefff 1eed711
I don't think we're doing anything special here, so lets bump
threefjefff ee5b30c
Add a doc comment
threefjefff 036b5bc
Stripping down to basics. YAGNI!
threefjefff 37acf17
Vestigial mark definition
threefjefff 415239c
Vestigial mark definition (2)
threefjefff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { test, expect, Page } from "@playwright/test"; | ||
import { | ||
switchMode, | ||
clearEditor, | ||
editorSelector, | ||
enterTextAsMarkdown, | ||
} from "../e2e-helpers"; | ||
|
||
test.describe.serial("roundtrip tests", () => { | ||
let page: Page; | ||
test.beforeAll(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
await page.goto("/empty.html"); | ||
await switchMode(page, "markdown"); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await page.close(); | ||
}); | ||
|
||
for (const [markdown] of [ | ||
//Basic commonmark | ||
["plain"], | ||
["*italic*"], | ||
["_italic_"], | ||
["**bold**"], | ||
["__bold__"], | ||
["# H1"], | ||
["## H2"], | ||
["[link](http://www.example.com)"], | ||
[""], | ||
["> blockquote"], | ||
["* List Item"], | ||
["- List Item"], | ||
["1. List Item"], | ||
["2) List Item"], | ||
["lol\n\n---\n\nlmao"], | ||
["lol\n\n***\n\nlmao"], | ||
["`code`"], | ||
//TODO: Codeblock does weird things roundtripping: Adds an extra space | ||
//['```javascript\ncodeblock\n```' ], | ||
|
||
//Escape character | ||
[String.raw`\# not a header`], | ||
[String.raw`- \# list item (not header)`], | ||
] as const) { | ||
test(`should make markdown -> richtext -> markdown round trip '${JSON.stringify(markdown)}'`, async () => { | ||
await clearEditor(page); | ||
await enterTextAsMarkdown(page, markdown); | ||
await switchMode(page, "markdown"); | ||
|
||
const text = await page.innerText(editorSelector); | ||
expect(text).toBe(markdown); | ||
}); | ||
} | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Good knowledge for a potential follow up ticket (in case it is worth fixing of course).