Skip to content

Support import paths via inline instead of inline mdx #7

@hamlim

Description

@hamlim

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions