shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.72k stars 1.27k forks source link

[Feature] Import external markdown file #83

Closed mxschmitt closed 2 years ago

mxschmitt commented 3 years ago

It would be useful if withLayout would be kinda exposed so importing an existing markdown file on the disk from the parent directory e.g. could be imported without relying on next-mdx-remote.

tvvignesh commented 3 years ago

@shuding I tried to import an mdx and md file from within my mdx but didn't seem to work. Is it supported? Looking to have support for partials so that I can import other files like this.

---
id: typescript-react-apollo
title: TypeScript React Apollo
---

import '../plugins/client-note.md'

import '../generated-config/typescript-react-apollo.md'

## Usage Example

### With React Hooks
shuding commented 3 years ago

@tvvignesh Unfortunately that's not supported, you can only import React components currently.

tvvignesh commented 3 years ago

@shuding Thanks for letting me know 👍 Any way that we can use remark plugins to do this? For instance, https://github.com/dotansimha/remark-import-partial is a remark plugin which helps importing partials. Was not able to find any docs on using such plugins with Nextra. Possible? Thanks.

dimaMachina commented 2 years ago

@shuding any updates for this one? In v2?