UNPKG

7.51 kBMarkdownView Raw
1<p align="center" style="margin-bottom: -20px">
2 <img src="https://cdn-std.dprcdn.net/files/acc_649651/BSPk3z">
3</p>
4
5<p align="center">
6 <a href="https://www.npmjs.com/package/docz" target="_blank">
7 <img src="https://badgen.net/npm/v/docz" alt="">
8 </a>
9 <a href="LICENSE.md" target="_blank">
10 <img src="https://badgen.net/badge/license/MIT/blue" alt="">
11 </a>
12 <a href="https://www.npmjs.com/package/docz" target="_blank">
13 <img src="https://badgen.net/npm/dt/docz" alt="">
14 </a>
15 <a href="http://feedback.docz.site/roadmap" target="_blank">
16 <img src="https://img.shields.io/badge/check-our%20roadmap-5362F5.svg" alt="Chat">
17 </a>
18</p>
19
20Docz makes it easy to write and publish beautiful interactive documentation for your code.
21
22Create MDX files showcasing your code and Docz turns them into a live-reloading, production-ready site.
23
24![docz example](https://cdn-std.dprcdn.net/files/acc_649651/S2YCID)
25
26## Table of Contents
27
28
29- [Why ?](#why)
30- [Start a New Project](#start-a-new-project)
31- [Add Docz to an Existing Project](#add-docz-to-an-existing-project)
32- [Build](#build)
33- [Deploy](#deploy)
34- [Examples](#examples)
35- [More info on docz.site](#more-info-on-doczsite)
36- [Used by](#used-by)
37- [Contributors](#contributors)
38- [Contributing](#contributing)
39
40## Why ?
41
42Documenting code is one of the most important and time-heavy processes when developing software.
43
44A lot of time is spent on building and maintaining custom documentation sites.
45
46Docz enables you to quickly create live-reloading, seo-friendly, production-ready documentation sites with MDX and customize the look, feel and behavior when required by leveraging [GatsbyJS](https://www.gatsbyjs.org) and [Gatsby theme shadowing](https://www.gatsbyjs.org/docs/themes/shadowing/).
47
48## Start a New Project
49
50Use [create-docz-app](https://www.npmjs.com/package/create-docz-app) to quickly get started :
51
52```sh
53npx create-docz-app my-docz-app
54# or
55yarn create docz-app my-docz-app --example typescript
56```
57
58## Add Docz to an Existing Project
59
60Start by adding `docz` as a dependency :
61
62```bash
63$ yarn add docz@next # react react-dom
64
65# or
66
67$ npm install docz@next # react react-dom
68```
69
70> **Note**: `react` and `react-dom` will not be installed automatically. You'll have to install them yourself.
71
72Then, add `.mdx` files anywhere in your project:
73
74```mdx
75---
76name: Button
77route: /
78---
79
80import { Playground, Props } from 'docz'
81import Button from './Button'
82
83# Button
84
85<Props of={Button} />
86
87## Basic usage
88
89<Playground>
90 <Button type="submit">Click me</Button>
91 <Button>No, click me</Button>
92</Playground>
93```
94
95And a Button component `Button.jsx`:
96
97```typescript
98import React from 'react'
99import t from 'prop-types'
100
101const Button = ({ children, type }) => <button type={type}>{children}</button>
102
103Button.propTypes = {
104 /**
105 * This is a description for this prop.
106 * Button type.
107 */
108 type: t.oneOf(['button', 'submit', 'reset']),
109}
110Button.defaultProps = {
111 type: 'button',
112}
113export default Button
114```
115
116Finally, run:
117
118```bash
119yarn docz dev
120```
121
122This will start a local development server and open your documentation site in the browser.
123
124## Build
125
126`yarn docz build` will generate a static site for your site in `.docz/dist/`.
127
128You can try it out with `yarn docz serve` or by serving the generated site with your favorite static file server (e.g. `npx serve .docz/dist`).
129
130You can have `yarn docz build` emit to a different directory by providing a path to the `dest` field in your doczrc.js or from the command line : `yarn docz build --dest docs-site-directory`.
131
132## Deploy
133
134The output of docz consists of static assets only. This allows you to deploy your generated `docz` site with any static site hosting provider you'd like.
135
136Start by building your site with `yarn docz build`, if you haven't provided a `dest` flag to your config then you will find your generated files in `.docz/dist` to copy to the server.
137
138## Examples
139
140- **[basic](https://github.com/doczjs/docz/tree/master/examples/basic)** - Barebones example.
141- **[gatsby](https://github.com/doczjs/docz/tree/master/examples/gatsby)** - Example using Docz in a Gastby project.
142- **[react native](https://github.com/doczjs/docz/tree/master/examples/react-native)** - Using Docz in a React Native project.
143- **[styled-components](https://github.com/doczjs/docz/tree/master/examples/styled-components)** - Using Docz with `styled-components`.
144- **[with typescript](https://github.com/doczjs/docz/tree/master/examples/typescript)** - Using Docz with Typescript.
145- **[with flow](https://github.com/doczjs/docz/tree/master/examples/flow)** - Using Docz with Flow.
146- **[with images](https://github.com/doczjs/docz/tree/master/examples/images)** - Using Docz with images in mdx and jsx.
147
148- **[with sass](https://github.com/doczjs/docz/tree/master/examples/sass)** - Using Docz parsing CSS with SASS.
149- **[with less](https://github.com/doczjs/docz/tree/master/examples/less)** - Using Docz parsing CSS with LESS.
150- **[with stylus](https://github.com/doczjs/docz/tree/master/examples/css-stylus)** - Using Docz parsing CSS with Stylus.
151- **with css modules**: works out of the box with gatsby
152
153You can check the complete list of docz examples [here](https://github.com/doczjs/docz/tree/master/examples).
154
155## More info on [docz.site](https://docz.site)
156
157## Used by
158
159- **[Smooth UI](https://smooth-ui.smooth-code.com/)** - Modern React UI library.
160- **[Set Protocol Docs](https://docs.setprotocol.com/)** - Documentation site of Set Protocol.
161- **[RBX](https://dfee.github.io/rbx)** - The Comprehensive Bulma UI Framework for React.
162- **[Circuit UI](https://circuit.sumup.com/#/)** - React component library for [SumUp](https://sumup.com) web apps.
163- **[Fannypack](https://fannypack.style)** - A friendly & accessible React UI Kit built with [Reakit](https://reakit.io/).
164- **[React Pixi](https://reactpixi.org/#/)** - React Fiber renderer for Pixi.
165- **[React Hotkey Tooltip](https://react-hotkey-tooltip.netlify.com/#/)** - A global Hotkey provider with built in tooltip for React.
166- **[Sajari React SDK](https://sajari-sdk-react.netlify.com/)** - Library of React Components for the Sajari.
167
168## Contributors
169
170This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
171
172<a href="https://github.com/doczjs/docz/graphs/contributors"><img src="https://opencollective.com/docz/contributors.svg?width=890&button=false" /></a>
173
174## Contributing
175
176All kinds of contributions are very welcome and appreciated !
177
178If you want to contribute time to docz then here's a list of suggestions to get you started :
179
1801. Star the project.
1812. Help people in the [issues](https://github.com/doczjs/docz/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) by sharing your knowledge and experience.
1823. Find and report issues.
1834. Submit PRs to help solve issues or add features.
1845. Influence the future of docz with feature requests.
185
186If you're looking for a place to start make sure to check issues tagged with :
187
188[![Good First Issue](https://img.shields.io/github/issues/doczjs/docz/good%20first%20issue.svg)](https://github.com/doczjs/docz/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
189
190And make sure to read the [Contributing Guide](/CONTRIBUTING.md) before making a pull request.
191
192You can also contribute money to help secure docz's future.
193
194<p align="center">
195 <a href="https://opencollective.com/docz" target="_blank">
196 <img src="https://cdn-std.dprcdn.net/files/acc_649651/Q5nVhT" height="80" alt="Open Collective">
197 </a>
198</p>
\No newline at end of file