Giter VIP home page Giter VIP logo

mdx-docs's Introduction

MDX Docs

๐Ÿ“ Document and develop React components with MDX and Next.js

https://mdx-docs.now.sh/

Build Status Downloads Version MIT License

npm init docs
  • ๐Ÿ“ Create documentation with markdown
  • โš›๏ธ Import and use React components
  • โš™๏ธ Component-based API
  • ๐Ÿ’ป Live code examples
  • ๐Ÿ’… Customizable themes
  • โ–ฒ Built for Next.js

Getting Started

To create a new documentation site, run npm init docs and follow the prompts. Once the application has been generated, see the README.md for more documentation.

To add MDX Docs to an existing Next.js app, see the Custom Setup docs.

Using MDX

MDX lets you mix markdown with inline JSX to render React components. Write markdown as you normally would and use ES import syntax to use custom components in your document.

import { Box } from 'grid-styled'

# Hello MDX!

<Box
  p={3}
  bg='tomato'>
  This will render as a component
</Box>

Live Code

MDX Docs has built-in components to render JSX fenced code blocks as live previews with editable code, powered by react-live. To make a code block render as an editable example, use the .jsx language attribute (note the . prefix).

Live code example:

```.jsx
<button>Beep</button>
```

Components Scope

To add components to scope for use in the live code examples, pass a components object to the Layout component.

// example components
import React from 'react'

export default {
  Box: props => (
    <div
      {...props}
      style={{
        padding: '32px',
        backgroundColor: 'tomato'
      }}
    />
  )
}
// example _app.js
<Layout
  {...this.props}
  components={components}>
  <Layout.Main>
    <Component {...page} />
  </Layout.Main>
</Layout>

The components object can also include components to render the HTML elements in MDX.

Documentation


Prior Art

mdx-go, Compositor x0, mdx-deck, live-doc, Doctor Mark, docz

Related

Next.js, MDX, react-live

MIT License

mdx-docs's People

Contributors

elijahmanor avatar jaredk3nt avatar johno avatar jxnblk avatar macklinu avatar olivierbeaulieu avatar olizilla avatar orther avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mdx-docs's Issues

Local images

How would I use local images? I know it supports absolute URLs. Right now I imagine I'd need to make an image component.

Remove styled-components dependency

Yes, I like it a lot, but probably not everybody wants to use styled-components for their styleguides.

Instead, styled-jsx is default supported by Next.js and would be used just for layout styling. No extra-broken dependencies ๐Ÿ‘.

Deploy to GH pages

Should the README have docs on Next+GH pages. What's the Next way to deploy to GH pages?

npm init docs?

The installation instructions are a bit vague. all npm init docs does for me is generate a package.json file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.