Merge branch 'master' of github.com:facebookexperimental/Docusaurus

This commit is contained in:
Eric Vicenti 2017-08-08 11:09:10 -07:00
commit b8af2f010d
10 changed files with 38 additions and 34 deletions

View File

@ -1,6 +1,6 @@
---
id: doc-markdown
title: Documentation Markdown Features
title: Markdown Features
---
Docusaurus supports some extra features when writing documentation in markdown.

View File

@ -1,6 +1,6 @@
---
id: search
title: Documentation Search
title: Enabling Search
---
## Algolia Search Integration
@ -19,4 +19,3 @@ const siteConfig = {
...
}
```

View File

@ -1,6 +1,6 @@
---
id: site-config
title: Customizing siteConfig
title: siteConfig.js
---
A large part of site configuration is done by editing the `siteConfig.js` file.
@ -122,10 +122,9 @@ const siteConfig = {
"0f9f28b9ab9efae89810921a351753b5",
indexName: "github"
}
gaTrackingId: "U-A2352"
gaTrackingId: "U-A2352"
};
module.exports = siteConfig;
```

View File

@ -1,6 +1,6 @@
---
id: translation
title: Translations with Docusaurus
title: Translations
---
## Overview

View File

@ -18,6 +18,10 @@ class DocsSidebar extends React.Component {
render() {
let sidebar = this.props.metadata.sidebar;
let docsCategories = readCategories(sidebar);
const categoryName = docsCategories[this.props.metadata.language][0].name;
if (!categoryName) {
return null;
}
return (
<Container className="docsNavContainer" id="docsNav" wrapper={false}>
<SideNav

View File

@ -28,7 +28,7 @@ if (fs.existsSync(CWD + "/languages.js")) {
}
function readSidebar() {
const allSidebars = require(CWD + "/sidebar.json");
const allSidebars = require(CWD + "/sidebars.json");
const order = {};
Object.keys(allSidebars).forEach(sidebar => {
@ -123,18 +123,20 @@ function processMetadata(file) {
const order = readSidebar();
const id = metadata.localized_id;
metadata.sidebar = order[id].sidebar;
metadata.category = order[id].category;
if (order[id]) {
metadata.sidebar = order[id].sidebar;
metadata.category = order[id].category;
if (order[id].next) {
metadata.next_id = order[id].next;
metadata.next = language + "-" + order[id].next;
if (order[id].next) {
metadata.next_id = order[id].next;
metadata.next = language + "-" + order[id].next;
}
if (order[id].previous) {
metadata.previous_id = order[id].previous;
metadata.previous = language + "-" + order[id].previous;
}
}
if (order[id].previous) {
metadata.previous_id = order[id].previous;
metadata.previous = language + "-" + order[id].previous;
}
return { metadata, rawContent: rawContent };
}

View File

@ -20,7 +20,7 @@ const path = require("path");
const siteConfig = require(CWD + "/siteConfig.js");
const babylon = require("babylon");
const traverse = require("babel-traverse").default;
const sidebar = require(CWD + "/sidebar.json");
const sidebars = require(CWD + "/sidebars.json");
function writeFileAndCreateFolder(file, content) {
mkdirp.sync(file.replace(new RegExp("/[^/]*$"), ""));
@ -67,8 +67,8 @@ function execute() {
}
/* find sidebar category titles to translate */
Object.keys(sidebar).forEach(sb => {
const categories = sidebar[sb];
Object.keys(sidebars).forEach(sb => {
const categories = sidebars[sb];
Object.keys(categories).forEach(category => {
translations["localized-strings"][category] = category;
});

View File

@ -94,24 +94,24 @@ class Index extends React.Component {
contents={[
{
content:
"Write all of your documentation and blog posts in Markdown and have it built into a website you can publish",
"Save time and focus on your project's documentation. Simply write docs and blog posts with Markdown and Docusaurus will publish a set of static html files ready to serve.",
image: `${siteConfig.baseUrl}img/markdown.png`,
imageAlign: "top",
title: "Markdown Documentation"
title: "Powered by Markdown"
},
{
content:
"Write the content of your main pages as React components that automatically share a header and footer",
"Extend or customize your project's layout by reusing React. Docusaurus can be extended while reusing the same header and footer.",
image: `${siteConfig.baseUrl}img/react.svg`,
imageAlign: "top",
title: "React Main Pages"
title: "Built Using React"
},
{
content:
"Translate your docs and your website using Crowdin integration",
"Localization comes pre-configured. Use Crowdin to translate your docs into over 70 languages.",
image: `${siteConfig.baseUrl}img/translation.svg`,
imageAlign: "top",
title: "Translations"
title: "Ready for Translations"
}
]}
layout="threeColumn"
@ -123,14 +123,14 @@ class Index extends React.Component {
contents={[
{
content:
"Support users of all versions by easily providing documentation for each version of your program",
"Support users on all versions of your project. Document Versioning helps you keep documentation in sync with project releases.",
image: `${siteConfig.baseUrl}img/docusaurus.svg`,
imageAlign: "top",
title: "Versioning"
title: "Document Versioning"
},
{
content:
"Provide search for your documentation using Algolia DocSearch integration",
"Make it easy for your community to find what they need in your documentation. Currently supports Algolia DocSearch.",
image: `${siteConfig.baseUrl}img/docusaurus.svg`,
imageAlign: "top",
title: "Document Search"
@ -144,7 +144,7 @@ class Index extends React.Component {
contents={[
{
content:
"The provided site template lets you get a website for your project up and running quickly without having having to worry about all the site design. Provided example files help you configure your site.",
"Get up and running quickly without having having to worry about site design.",
imageAlign: "right",
image: `${siteConfig.baseUrl}img/docusaurus.svg`,
title: "Quick Setup"
@ -158,10 +158,10 @@ class Index extends React.Component {
contents={[
{
content:
"Use a local server to see how file changes affect your website without having to reload the server. Publish your site to GitHub pages manually using a script or with continuous integration like CircleCI.",
"Make design and documentation changes by using the included live server. Publish your site to GitHub pages or other static file hosts manually, using a script, or with continuous integration like CircleCI.",
imageAlign: "left",
image: `${siteConfig.baseUrl}img/docusaurus.svg`,
title: "Development and Deployment"
image: `${siteConfig.baseUrl}img/docusaurus_live.webp`,
title: "Develop and Deploy"
}
]}
layout="twoColumn"

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB