Skip to content

Commit

Permalink
add a page description and reduce redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
87xie committed Oct 3, 2024
1 parent 20e4963 commit 32c8939
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions docs/pages/docs/guide/advanced/table.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { Callout, Steps } from 'nextra/components'

# Rendering Tables

This guide covers different ways to render tables in MDX, including GFM syntax,
literal HTML tag, and dynamic JavaScript expressions.

## GFM syntax

In Markdown, it is preferable to write tables via
Expand Down Expand Up @@ -143,7 +146,8 @@ Table looks different compared to [GFM syntax table](#gfm-syntax):

### Why This Happens

Currently, [MDX](https://mdxjs.com/docs/using-mdx/#components) doesn't replace literal HTML elements with `<MDXProvider />{:jsx}`.
[MDX](https://mdxjs.com/docs/using-mdx/#components) doesn't replace literal HTML
elements with `<MDXProvider />{:jsx}`.

Adam Wathan, creator of Tailwind CSS submitted
[an issue](https://github.com/mdx-js/mdx/issues/821) in MDX2 to have some _an
Expand All @@ -167,27 +171,17 @@ Just wrap your table with curly braces `{` and `}`, e.g.
</table>}
```

Alternatively, you can define a custom table component to use in your MDX file:
Alternatively, create a reusable table component:

```mdx filename="MDX"
export function Table({ columns, data }) {
return (
<table>
{/* ... */}
</table>
)
return <table>{/* ... */}</table>
}

<Table
columns={...}
data={...}
/>
<Table columns={...} data={...} />
```

{/**
* Currently, remark-mdx-disable-explicit-jsx seems to be no longer maintained,
* and I'm not sure if it's compatible with MDX3."
*/}
{/* prettier-ignore */}
{/* #### Changing Default Behaviour
If this thing is still confusing for you, and you want to use regular literal
Expand Down

0 comments on commit 32c8939

Please sign in to comment.