Coder Social home page Coder Social logo

facebook / docusaurus Goto Github PK

View Code? Open in Web Editor NEW
56.0K 56.0K 8.4K 465.21 MB

Easy to maintain open source documentation websites.

Home Page: https://docusaurus.io

License: MIT License

JavaScript 0.94% CSS 1.92% TypeScript 96.87% EJS 0.02% XSLT 0.26%
documentation hacktoberfest javascript open-source react website

docusaurus's Introduction

Docusaurus

Docusaurus

Twitter Follow npm version GitHub Actions status PRs Welcome Discord Chat code style: prettier Tested with Jest Covered by Argos Gitpod Ready-to-Code Netlify Status Deploy with Vercel Deploy to Netlify

Introduction

Docusaurus is a project for building, deploying, and maintaining open source project websites easily.

Short on time? Check out our 5-minute tutorial โฑ๏ธ!

Tip: use docusaurus.new to test Docusaurus immediately in a playground.

  • Simple to Start

Docusaurus is built in a way so that it can get running in as little time as possible. We've built Docusaurus to handle the website build process so you can focus on your project.

  • Localizable

Docusaurus ships with localization support via CrowdIn. Empower and grow your international community by translating your documentation.

  • Customizable

While Docusaurus ships with the key pages and sections you need to get started, including a home page, a docs section, a blog, and additional support pages, it is also customizable as well to ensure you have a site that is uniquely yours.

Installation

Use the initialization CLI to create your site:

npm init docusaurus@latest

Read the docs for any further information.

Contributing

We've released Docusaurus because it helps us better scale and supports the many OSS projects at Facebook. We hope that other organizations can benefit from the project. We are thankful for any contributions from the community.

Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.

Contributing guide

Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Docusaurus.

Beginner-friendly bugs

To help you get your feet wet and get you familiar with our contribution process, we have a list of beginner-friendly bugs that might contain smaller issues to tackle first. This is a great place to get started.

Contact

We have a few channels for contact:

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! ๐Ÿ™ Become a backer

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. Become a sponsor

License

Docusaurus is MIT licensed.

The Docusaurus documentation (e.g., .md files in the /docs folder) is Creative Commons licensed.

Special thanks

BrowserStack logo

BrowserStack supports us with free access for open source.

Rocket Validator logo

Rocket Validator helps us find HTML markup or accessibility issues.

docusaurus's People

Contributors

amyrlam avatar armano2 avatar ayonious avatar deltice avatar dependabot[bot] avatar endiliey avatar ericnakagawa avatar fanny avatar forresst avatar homotechsual avatar hong4rc avatar hramos avatar italicize avatar joelmarcey avatar johnnyreilly avatar josh-cena avatar lex111 avatar massoudmaboudi avatar nschonni avatar ozakione avatar pranabdas avatar rdil avatar rickyvetter avatar samchou19815 avatar simek avatar slorber avatar tats-u avatar teikjun avatar wgao19 avatar yangshun 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  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

docusaurus's Issues

Runtime error when adding new translation string.

Adding a new translation tag like <translate>hello</translate> without running docusaurus-write-translations results in a cryptic runtime error when running docusaurus-start. Would be nice to get explicit instructions on next steps.

TypeError: Cannot read property 'replace' of undefined
    at parseEscapeSequences (/path/to/website/node_modules/docusaurus/lib/server/translate.js:16:10)
    at translate (/path/to/website/node_modules/docusaurus/lib/server/translate.js:32:10)
    at Index.render (/path/to/website/node_modules/docusaurus/lib/pages/en/tempindex.js:204:15)
    at /path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:793:21
    at measureLifeCyclePerf (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:73:12)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:792:25)
    at ReactCompositeComponentWrapper._renderValidatedComponent (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:819:32)
    at ReactCompositeComponentWrapper.performInitialMount (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:359:30)
    at ReactCompositeComponentWrapper.mountComponent (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:255:21)
    at Object.mountComponent (/path/to/website/node_modules/react-dom/lib/ReactReconciler.js:43:35)

[Enhancement] Improved code blocks

In this issue I want to collect some ideas for improving our fenced code block widget. 1.0 will launch without this.

  • Language toggling
    A good example of this can be found in the Parse docs.
  • Sub-language toggles
    (e.g. ES6, ES5)
  • Line highlighting
    Support ```javascript{3,5-7} syntax for highlighting (#105 @rickyvetter)

(There may be other ideas for features to implement in this issue facebook/react#10991)

Remove react-warning-keys

When Docusaurus is running, the following warning can be seen in the console when a page is accessed:

Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `Marked`. See https://fb.me/react-warning-keys for more information.
    in p (created by Marked)
    in Marked (created by GridBlock)
    in h2 (created by GridBlock)
    in div (created by GridBlock)
    in div (created by GridBlock)
    in div (created by GridBlock)
    in GridBlock (created by Index)
    in div (created by Container)
    in div (created by Container)
    in Container (created by Index)
    in div (created by Index)
    in div (created by Index)
    in Index
    in div (created by Site)
    in body (created by Site)
    in html (created by Site)
    in Site

Fixing this warning is straightforward in React code, but notice that it's coming from marked.js. If I understand this correctly, we're generating HTML from Markdown and placing the output inside a React component. The generated HTML lacks the keys props, causing this warning to show.

We're using a local copy of marked.js, and not the one from npm, IIRC.

Read More link on blog posts

It looks like blog posts without <!--truncate--> comments still show a Read More link even though they are shown in entirety in the /blog page.

API Change: siteConfig headerLinks

headerLinksInternal and headerLinksExternal should be replaced with one array in siteConfig: headerLinks.

Each headerLink is one of the following:

Link to Doc:

{
  doc: 'foo',
  label: 'Foo Doc',
}

Link to Page:

{
  page: 'foo/bar',
  label: 'Foo Page',
}

This is the page located at website/pages/[en/]foo/bar.js

Manual/External Link

{
  href: 'https://github.com/facebookexperimental/Docusaurus',
  label: 'GitHub',
  external: true,
}

Search Box

Specifies the location of the search box in the header

{search: true}

Remove use-check-prop-types warning

The following warning can be seen in the console when a page is served by Docusaurus:

Warning: Failed Context Types: Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types Check the rend

Better crowdin command documentation.

Currently in the translation documentation it's recommended that you add a line like: "crowdin-upload": "export CROWDIN_DOCUSAURUS_PROJECT_ID=$YOUR_CROWDIN_ID; export CROWDIN_DOCUSAURUS_API_KEY=$YOUR_CROWDIN_API_KEY; crowdin-cli --config ../crowdin.yaml upload sources --auto-update -b master", to your package.json. What is crowdin-cli? It doesn't work the the npm i crowdin-cli package, and the recommended crowdin cli uses the crowdin command. Is there a different package I should be looking at?

Feature: Pluggable infrastructure

We need to figure out a way to make Docusaurus pluggable.

There are features we are not going to support that some people may want. How can we make it easy for folks to add those features.

Feature Request - Blog mode

A personal site like mine could benefit from a "start at blog" feature.

How it would work:

Set starting page as /blog --> reroute /index to /blog

Could also render the /blog in /index.html

[feature request] manual deploy

I definitely see the advantage of setting up CI deploys, but it would be really nice to be able to run docusaurus-publish --manual or docusaurus-publish --local and deploy from your own machine with your github identity. I think this would lower the barrier greatly for getting a site up and getting it running.

docusaurus-examples places examples in wrong subdirectory

The example files are being copied to YOUR_SITE/website/YOUR_SITE/website/node_modules/docusaurus/examples instead of YOUR_SITE/website.

Consider a new plain example site, docusample, with a single package.json file:

$ pwd
/Users/hramos/git/examples/docusample/website
$ ls -ltras
total 8
8 -rw-r--r--    1 hramos  THEFACEBOOK\Domain Users   314 Aug  7 14:31 package.json
0 drwxr-xr-x    4 hramos  THEFACEBOOK\Domain Users   136 Aug  7 14:51 ..
0 drwxr-xr-x    4 hramos  THEFACEBOOK\Domain Users   136 Aug  7 14:52 .

It's contents are:

{
  "scripts": {
    "start": "docusaurus-start",
    "build": "docusaurus-build",
    "publish-gh-pages": "docusaurus-publish",
    "examples": "docusaurus-examples"
  },
  "devDependencies": {
    "docusaurus": "[email protected]:facebookexperimental/Docusaurus.git"
  }
}

Running npm run examples will place all the placeholder files inside YOUR_SITE/website/YOUR_SITE/website/node_modules/docusaurus/examples/ instead of YOUR_SITE/website/ itself:

$ pwd
/Users/hramos/git/examples/docusample/website
$ ls -ltras
total 8
8 -rw-r--r--    1 hramos  THEFACEBOOK\Domain Users   314 Aug  7 14:31 package.json
0 drwxr-xr-x    4 hramos  THEFACEBOOK\Domain Users   136 Aug  7 14:51 ..
0 drwxr-xr-x  258 hramos  THEFACEBOOK\Domain Users  8772 Aug  7 14:55 node_modules
0 drwxr-xr-x    3 hramos  THEFACEBOOK\Domain Users   102 Aug  7 14:55 docusample
0 drwxr-xr-x    5 hramos  THEFACEBOOK\Domain Users   170 Aug  7 14:55 .
$ ls -ltras docusample/website/node_modules/docusaurus/examples/
total 16
0 drwxr-xr-x  3 hramos  THEFACEBOOK\Domain Users   102 Aug  7 14:55 static
8 -rw-r--r--  1 hramos  THEFACEBOOK\Domain Users  2481 Aug  7 14:55 siteConfig.js
8 -rw-r--r--  1 hramos  THEFACEBOOK\Domain Users   174 Aug  7 14:55 sidebar.json
0 drwxr-xr-x  3 hramos  THEFACEBOOK\Domain Users   102 Aug  7 14:55 pages
0 drwxr-xr-x  3 hramos  THEFACEBOOK\Domain Users   102 Aug  7 14:55 core
0 drwxr-xr-x  3 hramos  THEFACEBOOK\Domain Users   102 Aug  7 14:55 ..
0 drwxr-xr-x  7 hramos  THEFACEBOOK\Domain Users   238 Aug  7 14:55 .

Sidebars fails after adding a new item; not reflected in `i18n` and `translated_docs`

I added a valid item to the sidebar and then did docusaurus-write-translations (not sure if this part's relevant). When I go to the doc page it gives the typical error:

Error: Improper sidebars.json file. Make sure that documents with the ids specified in sidebars.json exist and that no ids are repeated

I've found out that it's because I downloaded all the translations through crowdin, which adds a new translated_docs folder and many json files into I18n. These aren't updated. Removing the folder and the other translation json files in i18n solves the problem.

Blog posts with . in file name don't get loaded correctly

For example - 2017-09-01-0.2.4.md will try to generate /blog/2017/09/01/0-2-4.html, but when loading the page using docusaurus-start there is an error message that looks like:

Error: ENOENT: no such file or directory, open '/path/to/project/website/blog/2017-09-01-0-2-4.md'

`yarn` install instructions

It'd be great to supply yarn instructions in addition to or in place of npm instructions. Most of this stuff maps directly between the two, but things like saving dev dependencies, yarn wants this to be written into the package.json file.

Website generation fails with SyntaxError: Unexpected token < | <DocsLayout ... >

Docusaurus is not starting up for me on a handful of demo sites. I was able to repro on a clean new project.

Steps to reproduce

  1. Create a brand new project. For example:
mkdir docusample 
cd docusample
mkdir website
touch website/package.json
  1. Update website/package.json with the following:
{
  "scripts": {
    "start": "docusaurus-start",
    "build": "docusaurus-build",
    "publish-gh-pages": "docusaurus-publish",
    "examples": "docusaurus-examples"
  },
  "devDependencies": {
    "docusaurus": "[email protected]:facebookexperimental/Docusaurus.git#63e3e311170fb5a8d8ae4efbd9f3d7b56f72887b"
  }
}

Note that this checks out a particular commit. I was able to reproduce the issue by pulling in docusaurus from master as well (by omitting the commit-ish string), but I am including this particular commit as it appears this is where the regression was introduced.

  1. Populate samples:
npm run examples
  1. Start the website server:
npm start

Expected Results

Website is up and running at port 3000

Actual Results

The following output is seen on the console:

$ npm start

> @ start /Users/hramos/git/examples/docusample/website
> docusaurus-start

/Users/hramos/git/examples/docusample/website/node_modules/docusaurus/lib/server/server.js:183
      <DocsLayout metadata={metadata} language={language} config={siteConfig}>
      ^

SyntaxError: Unexpected token <
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Module._extensions..js (module.js:580:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/hramos/git/examples/docusample/website/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)

Clobbering CSS files for external pages

If you have a page that you don't want to have the default design for the site, but it still has CSS files, and you put those CSS files in static, those files will possibly clobber the CSS files of the site.

To fix, maybe...

have a flag that tells Docusaurus which are the canonical CSS files that should be used when rendering. While the others will be ignored.

Fix mobile layout

I noticed that the React Native site looks weird on mobile. I'll come back to this task later with examples.

Docathon August 2017: Master Issue List

Use this to come up with issues and items we want to close during this docathon

  • Logo (@ericnakagawa)
  • Sidebar content (see below for details)
  • Landing Page - Includes icons/graphics, CSS (@ericnakagawa)
  • Footer
  • Help Page
  • Site look and feel - (@ericnakagawa)
  • Site launch (Cloudflare, SSL, nameservers) (@JoelMarcey)
  • CircleCI or Travis to actually publish the docusaurus.io website
  • Remove noindex meta tag from Head.js before launch (@JoelMarcey)
  • Finalize Jest PR (@ericnakagawa)

Better error message if remove default doc

Right now

TypeError: Cannot read property 'language' of undefined
    at /Users/joelm/dev/Docusaurus-primary/lib/server/server.js:160:22
    at Layer.handle [as handle_request] (/Users/joelm/dev/Docusaurus-primary/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/joelm/dev/Docusaurus-primary/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/joelm/dev/Docusaurus-primary/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/joelm/dev/Docusaurus-primary/node_modules/express/lib/router/layer.js:95:5)
    at /Users/joelm/dev/Docusaurus-primary/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/Users/joelm/dev/Docusaurus-primary/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/joelm/dev/Docusaurus-primary/node_modules/express/lib/router/index.js:275:10)
    at expressInit (/Users/joelm/dev/Docusaurus-primary/node_modules/express/lib/middleware/init.js:40:5)
    at Layer.handle [as handle_request] (/Users/joelm/dev/Docusaurus-primary/node_modules/express/lib/router/layer.js:95:5)

Probably could do a check and give a message like "Did you remove the default document and forget to remove from siteConfig.js"???

Licensing for installs of Docusaurus

When someone installs Docusaurus via yarn or npm, we need to do one or maybe two things re: licensing:

  1. Remove the license headers from the code that is generated in website for the site that uses Docusaurus since it points to the actual Docusaurus GitHub repo license which may not be applicable to the site using Docusaurus.

  2. Add our Examples license to the examples directory. We should discuss if this is the right thing to do.

Adding additional external links doesn't appear to work

In my siteConfig.json:

  /* header links for links outside the site */
  headerLinksExternal: [
    {
      section: "buck",
      href: "https://buckbuild.com",
      text: "Buck"
    },
    {
      section: "github",
      href: "https://github.com/deltice/test-site",
      text: "GitHub"
    }
  ],

Results in this HTML being generated:

<li><a href="https://buckbuild.com" class=""></a></li><li><a href="https://github.com/deltice/test-site" class="">GitHub</a></li>

While the node was created, it doesn't have the text in it. Order doesn't seem to matter; GitHub is always printed, and Buck isn't.

max callstack error

I'm running into a max call stack error for what I assume are deeply nested modules - I haven't really done anything outside of the default setup, so I'm assuming this is pretty easy to hit. Makes it so I'm unable to use docusaurus-start.

RangeError: Maximum call stack size exceeded
    at /reason-react/website/node_modules/docusaurus/lib/server/server.js:38:30
    at Array.forEach (<anonymous>)
    at traverse (/reason-react/website/node_modules/docusaurus/lib/server/server.js:38:22)
    at /reason-react/website/node_modules/docusaurus/lib/server/server.js:39:11
    at Array.forEach (<anonymous>)
    at traverse (/reason-react/website/node_modules/docusaurus/lib/server/server.js:38:22)
    at /reason-react/website/node_modules/docusaurus/lib/server/server.js:39:11
    at Array.forEach (<anonymous>)
    at traverse (/reason-react/website/node_modules/docusaurus/lib/server/server.js:38:22)
    at /reason-react/website/node_modules/docusaurus/lib/server/server.js:39:11

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.