-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[![PR App][icn]][demo] | :-------------------:| ## 🧰 Changes Moves the migration bits back to here. This PR attempts to pull in the changes from the main readme app that are specific to the on going migration to MDX. We had originally started moving migration specific changes to the main app for speed of development, and organization. But now, we need to be able to move the migration bits into the gitto backend. I tried to preserve the git histories of the specific files, so there's a little more context. ## 🧬 QA & Testing - [Broken on production][prod]. - [Working in this PR app][demo]. [demo]: https://markdown-pr-PR_NUMBER.herokuapp.com [prod]: https://SUBDOMAIN.readme.io [icn]: https://user-images.githubusercontent.com/886627/160426047-1bee9488-305a-4145-bb2b-09d8b757d38a.svg
- Loading branch information
1 parent
7be267e
commit ead267e
Showing
19 changed files
with
970 additions
and
194 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as rmdx from '../../index'; | ||
|
||
describe('migrating emphasis', () => { | ||
it('trims whitespace surrounding phrasing content (emphasis, strong, etc)', () => { | ||
const md = '** bold ** and _ italic _ and *** bold italic ***'; | ||
|
||
const mdx = rmdx.mdx(rmdx.mdastV6(md)); | ||
expect(mdx).toMatchInlineSnapshot(` | ||
"**bold** and *italic* and ***bold italic*** | ||
" | ||
`); | ||
}); | ||
|
||
it('moves whitespace surrounding phrasing content (emphasis, strong, etc) to the appropriate place', () => { | ||
const md = '**bold **and also_ italic_ and*** bold italic***aaaaaah'; | ||
|
||
const mdx = rmdx.mdx(rmdx.mdastV6(md)); | ||
expect(mdx).toMatchInlineSnapshot(` | ||
"**bold** and also *italic* and ***bold italic***aaaaaah | ||
" | ||
`); | ||
}); | ||
|
||
it('migrates a complex case', () => { | ||
const md = | ||
'*the recommended initial action is to**initiate a [reversal operation (rollback)](https://docs.jupico.com/reference/ccrollback) test**. *'; | ||
|
||
const mdx = rmdx.mdx(rmdx.mdastV6(md)); | ||
expect(mdx).toMatchInlineSnapshot(` | ||
"*the recommended initial action is to**initiate a [reversal operation (rollback)](https://docs.jupico.com/reference/ccrollback) test**.* | ||
" | ||
`); | ||
}); | ||
}); |
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,48 @@ | ||
import * as rmdx from '../../index'; | ||
|
||
describe('migrating html comments', () => { | ||
it('migrates escaped html comments', () => { | ||
const md = ` | ||
<!-- | ||
## Walkthrough | ||
[block:html] | ||
{ | ||
"html": "<div style="position: relative; padding-bottom: 56.25%; height: 0;"><iframe src="https://www.loom.com/embed/53dd194717bb4965a8e838b95715ff18" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>" | ||
} | ||
[/block] | ||
<br /> | ||
\\--> | ||
`; | ||
|
||
const ast = rmdx.mdastV6(md); | ||
const mdx = rmdx.mdx(ast); | ||
expect(mdx).toMatchInlineSnapshot(` | ||
"{/* | ||
## Walkthrough | ||
[block:html] | ||
{ | ||
"html": "<div style="position: relative; padding-bottom: 56.25%; height: 0;"><iframe src="https://www.loom.com/embed/53dd194717bb4965a8e838b95715ff18" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>" | ||
} | ||
[/block] | ||
<br /> | ||
*/} | ||
" | ||
`); | ||
}); | ||
}); |
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,30 @@ | ||
import * as rmdx from '../../index'; | ||
|
||
describe('migrating images', () => { | ||
it('compiles images', () => { | ||
const md = ` | ||
[block:image] | ||
{ | ||
"images": [ | ||
{ | ||
"image": [ | ||
"https://fastly.picsum.photos/id/507/200/300.jpg?hmac=v0NKvUrOWTKZuZFmMlLN_7-RdRgeF-qFLeBGXpufxgg", | ||
"", | ||
"" | ||
], | ||
"align": "center", | ||
"border": true | ||
} | ||
] | ||
} | ||
[/block] | ||
`; | ||
|
||
const ast = rmdx.mdastV6(md); | ||
const mdx = rmdx.mdx(ast); | ||
expect(mdx).toMatchInlineSnapshot(` | ||
"<Image align="center" className="border" border={true} src="https://fastly.picsum.photos/id/507/200/300.jpg?hmac=v0NKvUrOWTKZuZFmMlLN_7-RdRgeF-qFLeBGXpufxgg" /> | ||
" | ||
`); | ||
}); | ||
}); |
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,31 @@ | ||
import * as rmdx from '../../index'; | ||
|
||
describe('mdx migration of link references', () => { | ||
it('compiles link references correctly', () => { | ||
const md = '[wat_wat]'; | ||
|
||
const ast = rmdx.mdastV6(md); | ||
const mdx = rmdx.mdx(ast); | ||
expect(mdx).toMatchInlineSnapshot(` | ||
"\\[wat\\_wat] | ||
" | ||
`); | ||
}); | ||
|
||
it('compiles link references with defintions correctly', () => { | ||
const md = ` | ||
[wat_wat] | ||
[wat_wat]: https://wat.com | ||
`; | ||
|
||
const ast = rmdx.mdastV6(md); | ||
const mdx = rmdx.mdx(ast); | ||
expect(mdx).toMatchInlineSnapshot(` | ||
"[wat\\_wat][wat_wat] | ||
[wat_wat]: https://wat.com | ||
" | ||
`); | ||
}); | ||
}); |
Oops, something went wrong.