generated from ony3000/node-library-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from ony3000/fix-markdown
Leave Prettier's output as is for code blocks embedded in markdown and mdx
- Loading branch information
Showing
30 changed files
with
1,239 additions
and
0 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
59 changes: 59 additions & 0 deletions
59
tests/v2-test/markdown/issue-80/__snapshots__/absolute.test.ts.snap
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,59 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`'(1) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`jsx | ||
<div /> | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(2) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`jsx | ||
import foo from "foo"; | ||
<div />; | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(3) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`jsx | ||
export function Foo({ children }) { | ||
return ( | ||
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque"> | ||
{children} | ||
</div> | ||
); | ||
} | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(4) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`tsx | ||
<div /> | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(5) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`tsx | ||
import foo from "foo"; | ||
<div />; | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(6) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`tsx | ||
export function Foo({ children }) { | ||
return ( | ||
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque"> | ||
{children} | ||
</div> | ||
); | ||
} | ||
\`\`\` | ||
" | ||
`; |
59 changes: 59 additions & 0 deletions
59
tests/v2-test/markdown/issue-80/__snapshots__/ideal.test.ts.snap
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,59 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`'(1) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`jsx | ||
<div /> | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(2) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`jsx | ||
import foo from "foo"; | ||
<div />; | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(3) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`jsx | ||
export function Foo({ children }) { | ||
return ( | ||
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque"> | ||
{children} | ||
</div> | ||
); | ||
} | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(4) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`tsx | ||
<div /> | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(5) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`tsx | ||
import foo from "foo"; | ||
<div />; | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(6) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`tsx | ||
export function Foo({ children }) { | ||
return ( | ||
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque"> | ||
{children} | ||
</div> | ||
); | ||
} | ||
\`\`\` | ||
" | ||
`; |
59 changes: 59 additions & 0 deletions
59
tests/v2-test/markdown/issue-80/__snapshots__/relative.test.ts.snap
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,59 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`'(1) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`jsx | ||
<div /> | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(2) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`jsx | ||
import foo from "foo"; | ||
<div />; | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(3) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`jsx | ||
export function Foo({ children }) { | ||
return ( | ||
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque"> | ||
{children} | ||
</div> | ||
); | ||
} | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(4) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`tsx | ||
<div /> | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(5) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`tsx | ||
import foo from "foo"; | ||
<div />; | ||
\`\`\` | ||
" | ||
`; | ||
|
||
exports[`'(6) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = ` | ||
"\`\`\`tsx | ||
export function Foo({ children }) { | ||
return ( | ||
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque"> | ||
{children} | ||
</div> | ||
); | ||
} | ||
\`\`\` | ||
" | ||
`; |
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,13 @@ | ||
import { baseOptions } from 'test-settings'; | ||
|
||
import { thisPlugin, testSnapshotEach } from '../../adaptor'; | ||
import { fixtures } from './fixtures'; | ||
|
||
const options = { | ||
...baseOptions, | ||
plugins: [thisPlugin], | ||
parser: 'markdown', | ||
endingPosition: 'absolute', | ||
}; | ||
|
||
testSnapshotEach(fixtures, options); |
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,78 @@ | ||
import type { Fixture } from 'test-settings'; | ||
|
||
export const fixtures: Omit<Fixture, 'output'>[] = [ | ||
{ | ||
name: "(1) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.", | ||
input: ` | ||
\`\`\`jsx | ||
<div />; | ||
\`\`\` | ||
`, | ||
options: {}, | ||
}, | ||
{ | ||
name: "(2) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.", | ||
input: ` | ||
\`\`\`jsx | ||
import foo from 'foo' | ||
<div /> | ||
\`\`\` | ||
`, | ||
options: {}, | ||
}, | ||
{ | ||
name: "(3) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.", | ||
input: ` | ||
\`\`\`jsx | ||
export function Foo({ children }) { | ||
return ( | ||
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque"> | ||
{children} | ||
</div> | ||
); | ||
} | ||
\`\`\` | ||
`, | ||
options: { | ||
printWidth: 60, | ||
}, | ||
}, | ||
{ | ||
name: "(4) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.", | ||
input: ` | ||
\`\`\`tsx | ||
<div />; | ||
\`\`\` | ||
`, | ||
options: {}, | ||
}, | ||
{ | ||
name: "(5) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.", | ||
input: ` | ||
\`\`\`tsx | ||
import foo from 'foo' | ||
<div /> | ||
\`\`\` | ||
`, | ||
options: {}, | ||
}, | ||
{ | ||
name: "(6) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.", | ||
input: ` | ||
\`\`\`tsx | ||
export function Foo({ children }) { | ||
return ( | ||
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque"> | ||
{children} | ||
</div> | ||
); | ||
} | ||
\`\`\` | ||
`, | ||
options: { | ||
printWidth: 60, | ||
}, | ||
}, | ||
]; |
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,13 @@ | ||
import { baseOptions } from 'test-settings'; | ||
|
||
import { thisPlugin, testSnapshotEach } from '../../adaptor'; | ||
import { fixtures } from './fixtures'; | ||
|
||
const options = { | ||
...baseOptions, | ||
plugins: [thisPlugin], | ||
parser: 'markdown', | ||
endingPosition: 'absolute-with-indent', | ||
}; | ||
|
||
testSnapshotEach(fixtures, options); |
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,13 @@ | ||
import { baseOptions } from 'test-settings'; | ||
|
||
import { thisPlugin, testSnapshotEach } from '../../adaptor'; | ||
import { fixtures } from './fixtures'; | ||
|
||
const options = { | ||
...baseOptions, | ||
plugins: [thisPlugin], | ||
parser: 'markdown', | ||
endingPosition: 'relative', | ||
}; | ||
|
||
testSnapshotEach(fixtures, options); |
Oops, something went wrong.