File tree Expand file tree Collapse file tree 3 files changed +30
-11
lines changed Expand file tree Collapse file tree 3 files changed +30
-11
lines changed Original file line number Diff line number Diff line change 27
27
}
28
28
29
29
.ch-inline-code > code {
30
- padding : 0.2em 0.4 em ;
31
- margin : 0.1em -0.1 em ;
30
+ padding : 0.2em 0.15 em ;
31
+ margin : 0.1em -0.05 em ;
32
32
border-radius : 0.25em ;
33
33
font-size : 0.9em ;
34
34
}
Original file line number Diff line number Diff line change @@ -4,8 +4,24 @@ import {
4
4
CH_CODE_CONFIG_PLACEHOLDER ,
5
5
} from "./unist-utils"
6
6
import { Node } from "unist"
7
+ import visit from "unist-util-visit"
8
+ import { Parent } from "hast-util-to-estree"
7
9
8
10
export async function transformInlineCodes ( tree : Node ) {
11
+ visit ( tree , "emphasis" , ( node : Parent ) => {
12
+ if (
13
+ node . children &&
14
+ node . children . length === 1 &&
15
+ node . children [ 0 ] . type === "inlineCode"
16
+ ) {
17
+ node . type = "mdxJsxTextElement"
18
+ node . name = "CH.InlineCode"
19
+ node . children = [
20
+ { type : "text" , value : node . children [ 0 ] . value } ,
21
+ ]
22
+ }
23
+ } )
24
+
9
25
await visitAsync (
10
26
tree ,
11
27
[ "mdxJsxFlowElement" , "mdxJsxTextElement" ] ,
Original file line number Diff line number Diff line change 1
- < CH.Section >
1
+ Lorem ipsum dolor sit amet. _ ` console.log("foo bar") ` _ .
2
2
3
- Then also install the [ mdx plugin for next ] ( focus://2 ) , [ mdx ] ( focus://3 ) , [ foo bar] ( focus://4 ) .
3
+ Lorem ipsum dolor sit amet. ` console.log(" foo bar") ` .
4
4
5
- ``` bash focus=1
6
- npm install
7
- @next/mdx @mdx-js/loader
8
- @code-hike/
9
- mdx@next
10
- ```
5
+ _ ` console.log("foo bar") ` _
11
6
12
- </CH.Section >
7
+ _ ` console.log("foo bar") ` _
8
+
9
+ X <CH.InlineCode >console.log("foo bar")</CH.InlineCode >
10
+
11
+ Lorem ipsum ` var x = 1 `
12
+
13
+ _ Lorem ipsum ` var x = 1 ` _
14
+
15
+ ** ` console.log("foo bar") ` **
You can’t perform that action at this time.
0 commit comments