mirror of
https://github.com/c8r/x0.git
synced 2024-08-16 17:00:24 +03:00
Merge pull request #94 from ChristopherBiscardi/mdx-parsing
Mdx parsing
This commit is contained in:
commit
7a3dfacdcc
@ -7,6 +7,7 @@ module.exports = async function (src) {
|
||||
const { content, data } = matter(src)
|
||||
|
||||
const code = `export const frontMatter = ${stringifyObject(data)}
|
||||
|
||||
${content}
|
||||
`
|
||||
return callback(null, code)
|
||||
|
@ -29,9 +29,9 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@compositor/log": "^1.0.0-0",
|
||||
"@mdx-js/loader": "^0.11.0",
|
||||
"@mdx-js/mdx": "^0.10.1",
|
||||
"@mdx-js/tag": "^0.11.0",
|
||||
"@mdx-js/loader": "^0.15.0",
|
||||
"@mdx-js/mdx": "^0.15.0",
|
||||
"@mdx-js/tag": "^0.15.0",
|
||||
"@rebass/markdown": "^1.0.0-1",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
|
27
test/mdx-fm-loader.js
Normal file
27
test/mdx-fm-loader.js
Normal file
@ -0,0 +1,27 @@
|
||||
import test from "ava";
|
||||
import mdx from "@mdx-js/mdx";
|
||||
import { transform } from "babel-core";
|
||||
import env from "babel-preset-env";
|
||||
import react from "babel-preset-react";
|
||||
import stage0 from "babel-preset-stage-0";
|
||||
|
||||
import fmLoader from "../lib/mdx-fm-loader";
|
||||
|
||||
const content = `# A Heading
|
||||
|
||||
some other content`;
|
||||
|
||||
test("mdx-fm-loader", async t => {
|
||||
const loader = fmLoader.bind({
|
||||
async() {
|
||||
return (err, result) => {
|
||||
t.is(err, null, "mdx-fm-loader should not error");
|
||||
t.notThrows(() => {
|
||||
transform(mdx.sync(result), { presets: [env, react, stage0] });
|
||||
}, SyntaxError);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
const cb = await loader(content);
|
||||
});
|
Loading…
Reference in New Issue
Block a user