-
Notifications
You must be signed in to change notification settings - Fork 145
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
Bryce Kalow
authored
Feb 15, 2022
1 parent
d2ad91e
commit f08d885
Showing
23 changed files
with
20,602 additions
and
6,862 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 @@ | ||
name: 'Test' | ||
on: | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
name: 'Run Tests 🧪' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
cache: 'npm' | ||
cache-dependency-path: '**/package-lock.json' | ||
- name: Install and build | ||
run: | | ||
npm ci | ||
npm run build | ||
- name: Run Jest | ||
run: npm run test |
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,27 @@ | ||
import ReactDOMServer from 'react-dom/server' | ||
import React from 'react' | ||
|
||
import { MDXRemote, MDXRemoteProps } from '../src/index' | ||
import { serialize } from '../src/serialize' | ||
import { SerializeOptions } from '../src/types' | ||
|
||
export async function renderStatic( | ||
mdx: string, | ||
{ | ||
components, | ||
scope, | ||
mdxOptions, | ||
minifyOptions, | ||
parseFrontmatter, | ||
}: SerializeOptions & Pick<MDXRemoteProps, 'components'> = {} | ||
): Promise<string> { | ||
const mdxSource = await serialize(mdx, { | ||
mdxOptions, | ||
minifyOptions, | ||
parseFrontmatter, | ||
}) | ||
|
||
return ReactDOMServer.renderToStaticMarkup( | ||
<MDXRemote {...mdxSource} components={components} scope={scope} /> | ||
) | ||
} |
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 @@ | ||
engine-strict=true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"private": true | ||
} |
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.