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 2727}
2828
2929.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 ;
3232 border-radius : 0.25em ;
3333 font-size : 0.9em ;
3434}
Original file line number Diff line number Diff line change @@ -4,8 +4,24 @@ import {
44 CH_CODE_CONFIG_PLACEHOLDER ,
55} from "./unist-utils"
66import { Node } from "unist"
7+ import visit from "unist-util-visit"
8+ import { Parent } from "hast-util-to-estree"
79
810export 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+
925 await visitAsync (
1026 tree ,
1127 [ "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") ` _ .
22
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") ` .
44
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") ` _
116
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