1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-09-20 19:37:27 +03:00

Add emoji plugin

This commit is contained in:
Brent Jackson 2018-07-31 18:24:46 -04:00
parent 0882dabab9
commit d9fef9efe4
4 changed files with 17 additions and 3 deletions

12
cli.js
View File

@ -4,6 +4,9 @@ const meow = require('meow')
const open = require('react-dev-utils/openBrowser')
const chalk = require('chalk')
const ok = require('ok-cli')
const remark = {
emoji: require('remark-emoji')
}
const config = require('pkg-conf').sync('mdx-deck')
@ -38,7 +41,14 @@ const getConfig = conf => {
].map(require.resolve)
}
},
require.resolve('./lib/loader.js'),
{
loader: require.resolve('./lib/loader.js'),
options: {
mdPlugins: [
remark.emoji
]
}
}
]
}
]

View File

@ -43,5 +43,5 @@ import Box from 'superbox'
---
export default Layout
# Get started
# Get started :sunglasses:
[GitHub](https://github.com/jxnblk/mdx-deck)

View File

@ -1,3 +1,4 @@
const { getOptions } = require('loader-utils')
const mdx = require('@mdx-js/mdx')
const matter = require('gray-matter')
const stringifyObject = require('stringify-object')
@ -9,13 +10,14 @@ const SLIDEREG = /\n---\n/
module.exports = async function (src) {
const callback = this.async()
const options = getOptions(this) || {}
const { data, content } = matter(src)
const inlineModules = []
const slides = normalizeNewline(content)
.split(SLIDEREG)
.map(str => mdx.sync(str))
.map(str => mdx.sync(str, options))
.map(str => str.trim())
.map(str => str.replace(EXREG, '('))
.map(str => {

View File

@ -23,6 +23,7 @@
"chalk": "^2.4.1",
"clipboardy": "^1.2.3",
"gray-matter": "^4.0.1",
"loader-utils": "^1.1.0",
"lodash.debounce": "^4.0.8",
"meow": "^5.0.0",
"normalize-newline": "^3.0.0",
@ -31,6 +32,7 @@
"prop-types": "^15.6.2",
"react": "^16.4.1",
"react-dev-utils": "^5.0.1",
"remark-emoji": "^2.0.1",
"stringify-object": "^3.2.2",
"styled-components": ">=3.0.0",
"styled-system": "^3.0.2",