Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support import paths via inline instead of inline mdx #7

Open
hamlim opened this issue Aug 12, 2018 · 0 comments
Open

Support import paths via inline instead of inline mdx #7

hamlim opened this issue Aug 12, 2018 · 0 comments
Labels
✨enhancement New feature or request

Comments

@hamlim
Copy link
Owner

hamlim commented Aug 12, 2018

From a recent discussion on twitter: https://twitter.com/kentcdodds/status/1026817174717968386?s=20

It would be cool to be able to "import" mdx files without needing to use webpack:

API:

import React from 'react';
import {inline} from 'inline-mdx.macro';

const MDX = inline('./my-markdown-asset.md[x]');

render(
  <MDX />
);

I assume we would need to wrap our current "quasis" logic here which is handling tagged template literals in a conditional to verify that the user has in fact used the tagged template string vs use inline as a function and then fs.readFileSync the file and parse it as MDX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant