Skip to content

Commit f7e7efe

Browse files
committed
fix: .* could not match multi lines, use [\s\S]* instead, close #4
1 parent de73bf3 commit f7e7efe

File tree

5 files changed

+68
-4
lines changed

5 files changed

+68
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rxts/eslint-plugin-mdx",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "ESLint Parser/Plugin for MDX",
55
"repository": "[email protected]:rx-ts/eslint-plugin-mdx.git",
66
"author": "JounQin <[email protected]>",

src/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"declaration": true,
5-
"module": "commonjs",
65
"outDir": "../dist"
76
}
87
}

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->'
2626
export const OPEN_TAG_REGEX = new RegExp(`^(?:${openTag})$`)
2727
export const CLOSE_TAG_REGEX = new RegExp(`^(?:${closeTag})$`)
2828
export const OPEN_CLOSE_TAG_REGEX = new RegExp(
29-
`^(?:${openTag + '.*' + closeTag})$`,
29+
`^(?:${openTag + '[\\s\\S]*' + closeTag})$`,
3030
)
3131
export const VOID_TAG_REGEX = new RegExp(`^(?:${voidTag})$`)
3232
export const COMMENT_REGEX = new RegExp(`^(?:${comment})$`)

test/fixture4.mdx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: FollowReveal
3+
route: /follow-reveal
4+
---
5+
6+
# FollowReveal
7+
8+
A `<FollowReveal>` is a like a `<TurnReveal>` that follows the mouse's movements in and out of the component.
9+
Just like the `<TurnReveal>`, place it in an element that has `position: relative` and make sure it is a direct child of the element on which you define the `perspective` property.
10+
11+
import { Props, Playground } from 'docz'
12+
import FollowReveal from './FollowReveal'
13+
import { Front, PlaceHolderImage, Grid } from 'docs/PlayGroundUtils'
14+
15+
<Props of={FollowReveal} />
16+
17+
## Basic Usage
18+
19+
<Playground style={{ display: 'flex', justifyContent: 'center' }}>
20+
{() => {
21+
const perspective = 400
22+
return (
23+
<div style={{ position: 'relative', perspective: perspective + 'px' }}>
24+
<FollowReveal perspective={perspective}>
25+
<Front>More info</Front>
26+
</FollowReveal>
27+
<PlaceHolderImage />
28+
</div>
29+
)
30+
}}
31+
</Playground>
32+
33+
## Masonry Layout
34+
35+
Looks even cooler in a grid layout.
36+
37+
<Playground>
38+
{() => {
39+
const perspective = 400
40+
return (
41+
<Grid>
42+
{Array.from(Array(4 * 4).keys()).map(id => (
43+
<div
44+
key={id}
45+
style={{
46+
position: 'relative',
47+
perspective: perspective + 'px',
48+
}}
49+
>
50+
<FollowReveal perspective={perspective}>
51+
<Front>More info</Front>
52+
</FollowReveal>
53+
<div
54+
style={{
55+
background: '#e2e2e2',
56+
width: '100%',
57+
paddingBottom: '100%',
58+
}}
59+
/>
60+
</div>
61+
))}
62+
</Grid>
63+
)
64+
}}
65+
</Playground>

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"esModuleInterop": true,
66
"jsx": "preserve",
77
"lib": ["esnext", "dom"],
8-
"module": "esnext",
8+
"module": "commonjs",
99
"moduleResolution": "node",
1010
"sourceMap": true,
1111
"strict": true,

0 commit comments

Comments
 (0)