docs(v2): point to shared docs

This commit is contained in:
Yangshun Tay 2018-10-22 21:17:06 -04:00
parent ca7c3cebc1
commit 58d60b5650
15 changed files with 64 additions and 271 deletions

View file

@ -1,51 +0,0 @@
---
id: bar
title: My Title
---
# Remarkable
> Experience real-time editing with Remarkable!
Click the `clear` link to start with a clean slate, or get the `permalink` to share or save your results.
***
# h1 Heading
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading
## Horizontal Rules
This is horizontal rule
___
***
***
## Emphasis
**This is bold text**
__This is bold text__
*This is italic text*
_This is italic text_
~~Deleted text~~
Superscript: 19^th^
Subscript: H~2~O
++Inserted text++
==Marked text==

View file

@ -1,66 +0,0 @@
---
id: baz
title: Markdown
---
## Images
![Sakura](/img/sakura.png)
Like links, Images also have a footnote style syntax
![Alt text][id]
With a reference later in the document defining the URL location:
## Links
[link text](http://dev.nodeca.com)
[link with title](http://nodeca.github.io/pica/demo/ 'title text!')
Autoconverted link https://github.com/nodeca/pica (enable linkify to see)
## Footnotes
Footnote 1 link[^first].
Footnote 2 link[^second].
Inline footnote^[Text of inline footnote] definition.
Duplicated footnote reference[^second].
[^first]: Footnote **can have markup**
and multiple paragraphs.
[^second]: Footnote text.
## Definition lists
Term 1
: Definition 1 with lazy continuation.
Term 2 with _inline markup_
: Definition 2
{ some code, part of Definition 2 }
Third paragraph of definition 2.
_Compact style:_
Term 1 ~ Definition 1
Term 2 ~ Definition 2a ~ Definition 2b
## Abbreviations
This is HTML abbreviation example.
It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.
\*[HTML]: Hyper Text Markup Language

View file

@ -1,50 +0,0 @@
---
id: hello
title: Hello, World!
---
## Relative links
Replace this [highlight](highlight.md) [docusaurus](docusaurus.md)
Can't replace this [file](file.md)
Do not replace below
```
[highlight](highlight.md) [docusaurus](docusaurus.md)
```
## Blockquotes
> Blockquotes can also be nested...
>
> > ...by using additional greater-than signs right next to each other...
> >
> > > ...or with spaces between arrows.
## Lists
Unordered
- Create a list by starting a line with `+`, `-`, or `*`
- Sub-lists are made by indenting 2 spaces:
- Marker character change forces new list start:
- Ac tristique libero volutpat at
* Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
- Very easy!
Ordered
1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa
1) You can use sequential numbers...
1) ...or keep all the numbers as `1.`
Start numbering with offset:
57. foo
1. bar

View file

@ -1,43 +0,0 @@
---
id: code
title: Code
---
```cpp
#include<bits/stdc++.h>
using namespace std;
int main() {
cout << "Hello world\n";
return 0;
}
```
```cpp
#include <iostream>
using namespace std;
int main()
{
int n, i;
bool isPrime = true;
cout << "Enter a positive integer: ";
cin >> n;
for(i = 2; i <= n / 2; ++i)
{
if(n % i == 0)
{
isPrime = false;
break;
}
}
if (isPrime)
cout << "This is a prime number";
else
cout << "This is not a prime number";
return 0;
}
```

View file

@ -1,26 +0,0 @@
---
id: intro
title: Introduction
---
<h1 align="center">
<p align="center">Docusaurus</p>
<a href="https://docusaurus.io"><img src="/img/slash-introducing.png" alt="Docusaurus"></a>
</h1>
<p align="center">
<a href="https://www.npmjs.com/package/docusaurus"><a href="#backers" alt="sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/backers/badge.svg" /></a> <a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/sponsors/badge.svg" /></a> <img src="https://img.shields.io/npm/v/docusaurus.svg?style=flat" alt="npm version"></a>
<a href="https://circleci.com/gh/facebook/Docusaurus"><img src="https://circleci.com/gh/facebook/Docusaurus.svg?style=shield" alt="CircleCI Status"></a>
<a href="CONTRIBUTING.md#pull-requests"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"></a>
<a href="https://discord.gg/docusaurus"><img src="https://img.shields.io/badge/chat-on%20discord-7289da.svg" alt="Chat"></a>
<a href="https://github.com/prettier/prettier"><img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a>
<a href="https://github.com/facebook/jest"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg" alt="Tested with Jest"></a>
</p>
## Introduction
Docusaurus is a project for easily building, deploying, and maintaining open source project websites.
- **Simple to Start** Docusaurus is built to be easy to [get up and running](https://docusaurus.io/docs/en/installation.html) in as little time possible. We've built Docusaurus to handle the website build process so you can focus on your project.
- **Localizable** Docusaurus ships with [localization support](https://docusaurus.io/docs/en/translation.html) 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](https://docusaurus.io/docs/en/blog.html), and additional support pages, it is also [customizable](https://docusaurus.io/docs/en/custom-pages.html) as well to ensure you have a site that is [uniquely yours](https://docusaurus.io/docs/en/api-pages.html).

View file

@ -30,10 +30,9 @@ function compile(config) {
});
}
module.exports = async function build(siteDir, cliOptions = {}) {
module.exports = async function build(siteDir) {
process.env.NODE_ENV = 'production';
console.log('Build command invoked ...');
console.log(cliOptions);
const props = await load(siteDir);

View file

@ -27,7 +27,6 @@ async function getPort(reqPort) {
module.exports = async function start(siteDir, cliOptions = {}) {
console.log('Start command invoked ...');
console.log(cliOptions);
// Process all related files as a prop
const props = await load(siteDir);

View file

@ -38,7 +38,10 @@ class Doc extends React.Component {
/>
<div className={styles.mainContainer}>
<div className={styles.docContainer}>
<div className={styles.docContent}>{this.props.children}</div>
<div className={styles.docContent}>
<h1>{metadata.title}</h1>
{this.props.children}
</div>
<div className={styles.paginatorContainer}>
<DocsPaginator
docsMetadatas={docsMetadatas}

View file

@ -67,7 +67,7 @@ function Footer(props) {
</li>
</ul>
</div>
{/* This is for v2 development only to know which are the available routes */}
{/* This is for v2 development only to know which are the available page */}
<div className={styles.footerColumn}>
<h3 className={styles.footerColumnTitle}>Pages</h3>
<ul className={styles.footerList}>
@ -80,19 +80,6 @@ function Footer(props) {
))}
</ul>
</div>
<div className={styles.footerColumn}>
<h3 className={styles.footerColumnTitle}>Docs</h3>
<ul className={styles.footerList}>
{Object.values(props.docsMetadatas).map(metadata => (
<li key={metadata.permalink} className={styles.footerListItem}>
<Link className={styles.footerLink} to={metadata.permalink}>
{metadata.title}
</Link>
</li>
))}
</ul>
</div>
{/* Remove above when launching v2 */}
</section>
<section className={styles.copyright}>
<span>Copyright © {new Date().getFullYear()} Facebook Inc.</span>

View file

@ -3,7 +3,7 @@ import {NavLink} from 'react-router-dom';
import styles from './styles.css';
function Navbar(props) {
function Navbar() {
return (
<nav className={styles.navbar}>
<div className={styles.navbarInner}>
@ -18,7 +18,31 @@ function Navbar(props) {
<strong>Docusaurus</strong>
</NavLink>
</li>
{Object.values(props.docsMetadatas).map(metadata => (
<li className={styles.navListItem}>
<NavLink
activeClassName={styles.navLinkActive}
className={styles.navLink}
to="/docs/site-config">
Docs
</NavLink>
</li>
<li className={styles.navListItem}>
<NavLink
activeClassName={styles.navLinkActive}
className={styles.navLink}
to="https://docusaurus.io/blog">
Blog
</NavLink>
</li>
<li className={styles.navListItem}>
<NavLink
activeClassName={styles.navLinkActive}
className={styles.navLink}
to="https://github.com/facebook/docusaurus">
GitHub
</NavLink>
</li>
{/* Object.values(props.docsMetadatas).map(metadata => (
<li key={metadata.permalink} className={styles.navListItem}>
<NavLink
activeClassName={styles.navLinkActive}
@ -27,7 +51,7 @@ function Navbar(props) {
{metadata.title}
</NavLink>
</li>
))}
)) */}
</ul>
</div>
</nav>

View file

@ -43,6 +43,12 @@ module.exports = function createBaseConfig(props, isServer) {
.set('@build', outDir)
.set('@generated', path.resolve(__dirname, '../core/generated'))
.set('@core', path.resolve(__dirname, '../core'))
// For loading docs from custom paths where React is not available.
// TODO(yangshun): Change loader to convert return HTML instead of React component.
.set(
'DOCUSAURUS_NODE_MODULES_PATH_DO_NOT_USE_OR_YOU_WILL_BE_FIRED',
path.resolve(__dirname, '../../node_modules/'),
)
.end();
function applyBabel(rule) {

View file

@ -65,13 +65,12 @@ module.exports = function(fileString) {
}
/* Return a React component */
return (
`import React from 'react';\n` +
`import Markdown from '@theme/Markdown'\n` +
`export default () => (
return `
import React from 'DOCUSAURUS_NODE_MODULES_PATH_DO_NOT_USE_OR_YOU_WILL_BE_FIRED/react';
import Markdown from '@theme/Markdown';
export default () => (
<Markdown siteConfig={${JSON.stringify(siteConfig)}}>
{${JSON.stringify(content)}}
</Markdown>
);`
);
);`;
};

View file

@ -1,9 +1,20 @@
{
"docs": {
"Category 1": {
"Subcategory 1": ["foo/bar", "foo/baz"],
"Subcategory 2": ["hello"]
},
"Category 2": ["intro", "code"]
"Getting Started": [
"installation",
"site-preparation",
"site-creation",
"publishing",
"docker"
],
"Guides": [
"adding-blog",
"custom-pages",
"search",
"navigation",
"translation",
"versioning"
],
"API": ["commands", "doc-markdown", "api-pages", "site-config"]
}
}

View file

@ -4,4 +4,5 @@ module.exports = {
organizationName: 'facebook',
projectName: 'docusaurus',
baseUrl: '/',
customDocsPath: '../docs',
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB