├── .npmignore ├── packages ├── docs-components │ ├── .gitignore │ ├── .npmignore │ ├── .babelrc │ ├── src │ │ ├── theme.js │ │ ├── index.js │ │ ├── ThemeProvider.js │ │ ├── Pagination.js │ │ ├── Layout.js │ │ ├── SideBar.js │ │ └── Header.js │ ├── README.md │ └── package.json └── mdx-editable │ ├── .babelrc │ ├── __snapshots__ │ └── test.js.snap │ ├── test.js │ ├── package.json │ ├── src │ ├── index.js │ ├── LivePreview.js │ └── LiveEditor.js │ └── dist │ ├── index.js │ ├── LivePreview.js │ └── LiveEditor.js ├── templates ├── next │ ├── pages │ │ ├── components │ │ │ ├── index.md │ │ │ └── Button.md │ │ ├── getting-started.md │ │ ├── index.md │ │ ├── _document.js │ │ └── _app.js │ ├── .gitignore │ ├── README.md │ ├── next.config.js │ └── package.json └── x0 │ ├── .gitignore │ ├── pages │ ├── getting-started.md │ ├── index.md │ └── _app.js │ └── package.json ├── README.md ├── package.json └── cli.js /.npmignore: -------------------------------------------------------------------------------- 1 | templates 2 | packages 3 | -------------------------------------------------------------------------------- /packages/docs-components/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /templates/next/pages/components/index.md: -------------------------------------------------------------------------------- 1 | 2 | # Components 3 | -------------------------------------------------------------------------------- /templates/x0/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | dist 4 | -------------------------------------------------------------------------------- /packages/docs-components/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | tests/**/* 3 | .babelrc 4 | -------------------------------------------------------------------------------- /templates/next/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | .next 4 | out 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | **Deprecated** See [mdx-docs](https://github.com/jxnblk/mdx-docs) 3 | -------------------------------------------------------------------------------- /templates/next/pages/getting-started.md: -------------------------------------------------------------------------------- 1 | 2 | # Getting Started 3 | 4 | ```sh 5 | npm init docs 6 | ``` 7 | -------------------------------------------------------------------------------- /templates/x0/pages/getting-started.md: -------------------------------------------------------------------------------- 1 | 2 | # Getting Started 3 | 4 | ```sh 5 | npm init docs 6 | ``` 7 | -------------------------------------------------------------------------------- /packages/mdx-editable/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | presets: [ 3 | 'env', 4 | 'stage-0', 5 | 'react' 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /templates/next/pages/components/Button.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Button 4 | 5 | ```.jsx 6 | 7 | ``` 8 | -------------------------------------------------------------------------------- /packages/docs-components/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | presets: [ 3 | 'env', 4 | 'stage-0', 5 | 'react' 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/docs-components/src/theme.js: -------------------------------------------------------------------------------- 1 | export default { 2 | font: 'system-ui, sans-serif', 3 | lineHeight: 1.5, 4 | } 5 | -------------------------------------------------------------------------------- /templates/next/pages/index.md: -------------------------------------------------------------------------------- 1 | 2 | # npm init docs 3 | 4 | Next.js-based documentation site 5 | 6 | ```sh 7 | npm init docs 8 | ``` 9 | 10 | ```.jsx 11 |

LiveEditor

12 | ``` 13 | 14 | ```!jsx 15 |

LivePreview

16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /templates/x0/pages/index.md: -------------------------------------------------------------------------------- 1 | 2 | # npm init docs 3 | 4 | Compositor x0 based documentation site 5 | 6 | ```sh 7 | npm init docs 8 | ``` 9 | 10 | ```.jsx 11 |

LiveEditor

12 | ``` 13 | 14 | ```!jsx 15 |

LivePreview

16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /packages/docs-components/README.md: -------------------------------------------------------------------------------- 1 | 2 | # docs-components 3 | 4 | React components for documentation sites 5 | 6 | ```sh 7 | npm i docs-components 8 | ``` 9 | 10 | ## Components 11 | 12 | ### Layout 13 | ### ThemeProvider 14 | ### Header 15 | ### SideBar 16 | ### Pagination 17 | ### Container 18 | 19 | ## Theming 20 | -------------------------------------------------------------------------------- /packages/docs-components/src/index.js: -------------------------------------------------------------------------------- 1 | export { default as Layout } from './Layout' 2 | export { default as SideBar } from './SideBar' 3 | export { default as Header } from './Header' 4 | export { default as Pagination } from './Pagination' 5 | export { default as ThemeProvider } from './ThemeProvider' 6 | export { default as theme } from './theme' 7 | -------------------------------------------------------------------------------- /templates/x0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "start": "x0 pages", 7 | "build": "x0 build pages" 8 | }, 9 | "dependencies": { 10 | "@compositor/x0": "^6.0.2", 11 | "react": "^16.4.1", 12 | "styled-components": "^3.3.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /templates/x0/pages/_app.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { SidebarLayout } from '@compositor/x0/components' 3 | 4 | export default class extends React.Component { 5 | static defaultProps = { 6 | title: 'npm init docs', 7 | } 8 | 9 | render () { 10 | return ( 11 | 12 | ) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /templates/next/README.md: -------------------------------------------------------------------------------- 1 | 2 | # create-docs Next.js 3 | 4 | ## Getting Started 5 | 6 | ```sh 7 | npm install 8 | ``` 9 | 10 | ### Run in development mode 11 | 12 | ```sh 13 | npm start 14 | ``` 15 | 16 | ### Export static site 17 | 18 | ```sh 19 | npm run build 20 | ``` 21 | 22 | Built with [create-docs][] 23 | 24 | [create-docs]: https://github.com/jxnblk/create-docs 25 | -------------------------------------------------------------------------------- /packages/mdx-editable/__snapshots__/test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`mdx-editable LivePreview renders 1`] = ` 4 |
7 |
10 |
13 |

14 | hi 15 |

16 |
17 |
18 |
19 | `; 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-docs", 3 | "version": "1.0.0-3", 4 | "description": "", 5 | "main": "index.js", 6 | "bin": { 7 | "create-docs": "./cli.js" 8 | }, 9 | "scripts": { 10 | "test": "./cli.js" 11 | }, 12 | "keywords": [], 13 | "author": "Brent Jackson", 14 | "license": "MIT", 15 | "dependencies": { 16 | "chalk": "^2.4.1", 17 | "initit": "^1.0.0-2", 18 | "meow": "^5.0.0", 19 | "prompt": "^1.0.0", 20 | "prompts": "^0.1.12", 21 | "styled-system": "^2.3.6" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/docs-components/src/ThemeProvider.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled, { ThemeProvider } from 'styled-components' 3 | import { themeGet } from 'styled-system' 4 | import defaultTheme from './theme' 5 | 6 | export const Root = styled.div` 7 | font-family: ${themeGet('font', 'sans-serif')}; 8 | line-height: ${themeGet('lineHeight')}; 9 | ` 10 | 11 | export default class extends React.Component { 12 | static defaultProps = { 13 | theme: defaultTheme 14 | } 15 | 16 | render () { 17 | const { children, ...props } = this.props 18 | 19 | return ( 20 | 21 | 22 | {children} 23 | 24 | 25 | ) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/mdx-editable/test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { create as render } from 'react-test-renderer' 3 | import { 4 | code, 5 | pre, 6 | LivePreview, 7 | LiveEditor 8 | } from './src' 9 | 10 | const renderJSON = el => render(el).toJSON() 11 | 12 | describe('mdx-editable', () => { 13 | test('LiveEditor renders', () => { 14 | const json = renderJSON() 15 | expect(json).toMatchSnapshot() 16 | }) 17 | 18 | test('LivePreview renders', () => { 19 | const json = renderJSON() 20 | expect(json).toMatchSnapshot() 21 | }) 22 | 23 | test('code renders', () => { 24 | const json = renderJSON(React.createElement(code, { 25 | className: 'language-.jsx' 26 | }, 'hi')) 27 | expect(json).toMatchSnapshot() 28 | }) 29 | }) 30 | -------------------------------------------------------------------------------- /templates/next/next.config.js: -------------------------------------------------------------------------------- 1 | const remark = { 2 | images: require('remark-images'), 3 | emoji: require('remark-emoji'), 4 | slug: require('remark-slug'), 5 | autolinkHeadings: require('remark-autolink-headings'), 6 | } 7 | 8 | module.exports = { 9 | pageExtensions: ['js', 'jsx', 'md', 'mdx'], 10 | webpack: (config, { defaultLoaders }) => { 11 | config.module.rules.push({ 12 | test: /\.mdx?$/, 13 | use: [ 14 | defaultLoaders.babel, 15 | { 16 | loader: '@mdx-js/loader', 17 | options: { 18 | mdPlugins: [ 19 | remark.images, 20 | remark.emoji, 21 | remark.slug, 22 | remark.autolinkHeadings 23 | ] 24 | } 25 | }, 26 | 'mdx-fm-loader' 27 | ] 28 | }) 29 | 30 | return config 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /templates/next/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "start": "next", 7 | "build": "next build && next export" 8 | }, 9 | "dependencies": { 10 | "@mdx-js/loader": "^0.14.0", 11 | "@mdx-js/mdx": "^0.14.0", 12 | "@mdx-js/tag": "^0.14.0", 13 | "babel-loader": "^7.1.5", 14 | "clean-tag": "^1.0.4", 15 | "docs-components": "^1.0.0-0", 16 | "gray-matter": "^4.0.1", 17 | "grid-styled": "^4.3.2", 18 | "mdx-editable": "^1.0.0-0", 19 | "mdx-fm-loader": "^1.0.0-0", 20 | "next": "^6.1.1", 21 | "prop-types": "^15.6.2", 22 | "react": "^16.4.1", 23 | "react-dom": "^16.4.1", 24 | "remark-autolink-headings": "^5.0.0", 25 | "remark-emoji": "^2.0.1", 26 | "remark-images": "^0.8.1", 27 | "remark-slug": "^5.0.0", 28 | "stringify-object": "^3.2.2", 29 | "styled-components": "^3.3.3" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/docs-components/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docs-components", 3 | "version": "1.0.0-1", 4 | "description": "React components for documentation sites", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "prepare": "babel src -d dist", 8 | "test": "jest" 9 | }, 10 | "keywords": [], 11 | "author": "Brent Jackson", 12 | "license": "MIT", 13 | "devDependencies": { 14 | "babel-cli": "^6.26.0", 15 | "babel-preset-env": "^1.7.0", 16 | "babel-preset-react": "^6.24.1", 17 | "babel-preset-stage-0": "^6.24.1", 18 | "jest": "^23.4.1", 19 | "react": "^16.4.1", 20 | "react-test-renderer": "^16.4.1", 21 | "styled-components": "^3.3.3" 22 | }, 23 | "dependencies": { 24 | "clean-tag": "^1.0.4", 25 | "grid-styled": "^4.3.2", 26 | "prop-types": "^15.6.2", 27 | "reline": "^1.0.0-beta.3", 28 | "styled-system": "^2.3.6" 29 | }, 30 | "peerDependencies": { 31 | "styled-components": ">=3.0.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/docs-components/src/Pagination.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import PropTypes from 'prop-types' 3 | import { Flex, Box } from 'grid-styled' 4 | 5 | export default class Pagination extends React.Component { 6 | render () { 7 | const { routes, route, Link } = this.props 8 | const index = routes.indexOf(route) 9 | //routes.findIndex(r => r.path === route.path) 10 | const previous = routes[index - 1] 11 | const next = routes[index + 1] 12 | 13 | return ( 14 | 17 | {previous && ( 18 | 19 | 20 | {previous.name} 21 | 22 | 23 | )} 24 | 25 | {next && ( 26 | 27 | 28 | {next.name} 29 | 30 | 31 | )} 32 | 33 | ) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/mdx-editable/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mdx-editable", 3 | "version": "1.0.0-0", 4 | "description": "Components for editable fenced code blocks in MDX", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "prepare": "babel src -d dist", 8 | "test": "jest" 9 | }, 10 | "keywords": [], 11 | "author": "Brent Jackson", 12 | "license": "MIT", 13 | "peerDependencies": { 14 | "styled-components": ">=3.0.0" 15 | }, 16 | "dependencies": { 17 | "@mdx-js/tag": "^0.14.0", 18 | "grid-styled": "^4.3.2", 19 | "react": "^16.4.1", 20 | "react-live": "^1.11.0", 21 | "styled-system": "^2.3.6" 22 | }, 23 | "devDependencies": { 24 | "babel-cli": "^6.26.0", 25 | "babel-preset-env": "^1.7.0", 26 | "babel-preset-react": "^6.24.1", 27 | "babel-preset-stage-0": "^6.24.1", 28 | "jest": "^23.4.1", 29 | "react-test-renderer": "^16.4.1", 30 | "styled-components": "^3.3.3" 31 | }, 32 | "jest": { 33 | "testMatch": [ 34 | "**/test*.js" 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /templates/next/pages/_document.js: -------------------------------------------------------------------------------- 1 | import Document, { Head, Main, NextScript } from 'next/document' 2 | import { ServerStyleSheet } from 'styled-components' 3 | 4 | const BaseCSS = ({ css }) => 5 |