-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
365055b
commit a5f219b
Showing
12 changed files
with
153 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Tables | ||
|
||
If you have some tabular data, it may be easier to write it with mdx: | ||
|
||
```jsx MDX | ||
export const table = [ | ||
['Left', 'Center', 'Right'], | ||
['L0', '**bold**', '$1600'], | ||
['L1', '`code`', '$12'], | ||
['L2', '_italic_', '$1'], | ||
]; | ||
|
||
<Table align={['left', 'center', 'right']} rows={table} />; | ||
``` | ||
|
||
export const table = [ | ||
['Left', 'Center', 'Right'], | ||
['L0', '**bold**', '$1600'], | ||
['L1', '`code`', '$12'], | ||
['L2', '_italic_', '$1'], | ||
]; | ||
|
||
<Table align={['left', 'center', 'right']} rows={table} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { VFileMessage } from 'vfile-message'; | ||
|
||
export default class MdxSyntaxError extends SyntaxError { | ||
original = ''; | ||
|
||
constructor(error: VFileMessage, doc: string) { | ||
const { message, line, column, url } = error; | ||
|
||
const messages = [ | ||
`Uh oh! We ran into a syntax error at { line: ${line}, column: ${column} }, please see this url for more details: ${url}`, | ||
]; | ||
|
||
if (typeof line !== 'undefined') { | ||
messages.push(doc.split('\n')[line - 1]); | ||
|
||
if (typeof column !== 'undefined') { | ||
const prefix = new Array(column).map(() => '').join(' '); | ||
messages.push(`${prefix}↑ ${message}`); | ||
} | ||
} | ||
|
||
super(messages.join('\n')); | ||
|
||
this.original = error; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.