1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-11-29 13:58:02 +03:00

Adjust layouts

This commit is contained in:
Brent Jackson 2018-07-28 18:36:00 -04:00
parent 1db1973071
commit 8569391c50
3 changed files with 18 additions and 2 deletions

View File

@ -1 +1,7 @@
import React from 'react'
import Box from 'superbox'
export default ({ children }) =>
<Box p={4} bg='tomato'>
{children}
</Box>

View File

@ -1,3 +1,4 @@
import Layout from './Layout'
export { default as theme } from './theme'
# Hello
@ -10,6 +11,8 @@ export { default as theme } from './theme'
# Built with [MDX][]
You know it!
[MDX]: https://github.com/mdx-js/mdx
---
@ -19,3 +22,10 @@ import Box from 'superbox'
And you can import React components!
</Box>
---
export default Layout
# Slide Layouts
Each slide can have its own layout with a default export

View File

@ -2,7 +2,7 @@ const mdx = require('@mdx-js/mdx')
const matter = require('gray-matter')
const stringifyObject = require('stringify-object')
const EXREG = /export\sdefault\s/g
const EXREG = /export\sdefault\s\(/g
const MODREG = /^(import|export)\s/
module.exports = async function (src) {
@ -14,7 +14,7 @@ module.exports = async function (src) {
const slides = content.split('---\n')
.map(str => mdx.sync(str))
.map(str => str.trim())
.map(str => str.replace(EXREG, ''))
.map(str => str.replace(EXREG, '('))
.map(str => {
const lines = str.split('\n')
inlineModules.push(