[go: up one dir, main page]

Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
thecuvii committed Oct 18, 2022
1 parent cd4386b commit 6eca02a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

# Write Live Code with Sandpack in MDX
# Power MDX with Sandpack

<br/>
<br/>

## Usage

Expand All @@ -11,7 +13,7 @@ npm install remark-sandpack @codesandbox/sandpack-react

### 2. Register remark plugin

Maybe different for each MDX plugin you use, check out [examples](#Compatible) below.
It may be different for each MDX plugin you use. Check out [examples](#Compatible) below.

### 3. Write your code

Expand Down Expand Up @@ -77,7 +79,7 @@ All props will pass to `Sandpack` directly, except `files`.

2. Code Blocks

All code blocks inside `<Sandpack></Sandpack>` will be parsed, then be passed as `files` prop to `<Sandpack></Sandpack>`.
All code blocks contained within `<Sandpack>/Sandpack>` will be parsed and passed to `<Sandpack>/Sandpack>` as file props. 

That means you can define [file property](https://sandpack.codesandbox.io/docs/getting-started/custom-content#advanced-usage) in code block meta.

Expand Down Expand Up @@ -124,12 +126,14 @@ Code above will transform into:

❗️for docusaurus, you need upgrade mdx to v2, please checkout [docusaurus-mdx-2](https://github.com/pomber/docusaurus-mdx-2)

---
<br/>

## Advance Useage

### Custom Sandpack component

`remark-sandpack` will parse `<Sandpack></Sandpack>` jsx statement in your MDX files. If your custom sandpack component use different name, such as `SandpackEnhanced`:
`remark-sandpack` will parse `<Sandpack></Sandpack>` jsx statements in your MDX files. If your custom sandpack component uses a different name, such as `SandpackEnhanced`:

```js
// in your mdx config
Expand Down
1 change: 0 additions & 1 deletion examples/next-mdx/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "./styles.css";
document.getElementById("app").innerHTML = `
<h1>Hello Sandpack</h1>
`;

```

```css src/styles.css file=styles/globals.css
Expand Down

0 comments on commit 6eca02a

Please sign in to comment.