Skip to content

Commit

Permalink
v1.6.0 (#1133)
Browse files Browse the repository at this point in the history
* v1.6.0

* nits changelog

* typo
  • Loading branch information
endiliey authored and yangshun committed Dec 2, 2018
1 parent 61078e3 commit 0492ba5
Show file tree
Hide file tree
Showing 9 changed files with 1,356 additions and 4 deletions.
47 changes: 46 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,49 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## [Unreleased]

## [1.6.0] - 2018-11-28

This releases includes few bug fixes and featurs. One notable feature allows user to change/remove `docs` prefix from the generated docusaurus URL.

Welcome to our newest users, [React-Slate](http://react-slate.surge.sh/), [Hemera](https://hemerajs.github.io/hemera/), [React-Redux](https://react-redux.js.org/), [Spectrum](https://libspectrum.io/), [TorchCraftAI](https://torchcraft.github.io/TorchCraftAI/), and [Haul](https://callstack.github.io/haul/).

Thank you to the following contributors who helped with this release:

- @yangshun
- @endiliey
- @JoelMarcey
- @andrewShillito
- @kahkhang
- @domcorvasce
- @ellereeeee
- @maxaggedon
- @gianlucadonato
- @tsmrachel
- @Shriram-Balaji
- @noraj
- @alexperez
- @wgao19

### Fixed/Changed

- Live reload not working on second try ([#1103](https://github.com/facebook/Docusaurus/pull/1103))
- Fix missing TOC on i18n pages ([#1119](https://github.com/facebook/Docusaurus/pull/1119))
- Fix docusaurus-version not working for subcategory in sidebar ([#1124](https://github.com/facebook/Docusaurus/pull/1124))
- Fix docusaurus-version to allow duplicate id in different subdirectory ([#1125](https://github.com/facebook/Docusaurus/pull/1125))

## Docs
- Add guide on setting custom docs path ([#1098](https://github.com/facebook/Docusaurus/pull/1098))
- Document that `website` folder can be renamed ([#1106](https://github.com/facebook/Docusaurus/pull/1106))
- Specify markdown flavor ([#1118](https://github.com/facebook/Docusaurus/pull/1118))

### Added

- Allow modifying/removing `docs` route in generated url ([#914](https://github.com/facebook/Docusaurus/pull/914))
- Use `sidebar_label` in addition to `title` for prev/next button ([#1122](https://github.com/facebook/Docusaurus/pull/1122))
- Warn the users if any unresolved markdown links ([#1116](https://github.com/facebook/Docusaurus/pull/1116))
- Customizable search placeholder ([#1126](https://github.com/facebook/Docusaurus/pull/1126))
- New feature of displaying the last contributor to each document ([#980](https://github.com/facebook/Docusaurus/pull/980))

## [1.5.1] - 2018-11-03

A release where we had many external contributors! Very excited to see the community being involved in the project.
Expand Down Expand Up @@ -836,7 +879,9 @@ N/A
- Blog
- Documentation

[unreleased]: https://github.com/facebook/Docusaurus/compare/v1.5.0...HEAD
[unreleased]: https://github.com/facebook/Docusaurus/compare/v1.6.0...HEAD
[1.6.0]: https://github.com/facebook/Docusaurus/compare/v1.5.1...v1.6.0
[1.5.1]: https://github.com/facebook/Docusaurus/compare/v1.4.0...v1.5.1
[1.5.0]: https://github.com/facebook/Docusaurus/compare/v1.4.0...v1.5.0
[1.4.0]: https://github.com/facebook/Docusaurus/compare/v1.3.3...v1.4.0
[1.3.3]: https://github.com/facebook/Docusaurus/compare/v1.3.2...v1.3.3
Expand Down
15 changes: 12 additions & 3 deletions v1/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"name": "docusaurus",
"description": "Easy to Maintain Open Source Documentation Websites",
"version": "1.5.1",
"version": "1.6.0",
"license": "MIT",
"keywords": ["documentation", "websites", "open source", "docusaurus"],
"keywords": [
"documentation",
"websites",
"open source",
"docusaurus"
],
"repository": {
"type": "git",
"url": "https://github.com/facebook/Docusaurus.git"
Expand All @@ -15,7 +20,11 @@
"start": "cd website && yarn start"
},
"jest": {
"testPathIgnorePatterns": ["/node_modules/", "__fixtures__", "v2"],
"testPathIgnorePatterns": [
"/node_modules/",
"__fixtures__",
"v2"
],
"testURL": "http://localhost/",
"transform": {
"^.+\\.js$": "<rootDir>/jest.transform.js"
Expand Down
213 changes: 213 additions & 0 deletions v1/website/versioned_docs/version-1.6.0/api-doc-markdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
---
id: version-1.6.0-doc-markdown
title: Markdown Features
original_id: doc-markdown
---

Docusaurus uses [GitHub Flavored Markdown (GFM)](https://guides.github.com/features/mastering-markdown/). Find out more about Docusaurus-specific fields when writing Markdown.

## Markdown Headers

### Documents

Documents use the following markdown header fields that are enclosed by a line `---` on either side:

`id`: A unique document id. If this field is not present, the document's `id` will default to its file name (without the extension).

`title`: The title of your document. If this field is not present, the document's `title` will default to its `id`.

`hide_title`: Whether to hide the title at the top of the doc.

`sidebar_label`: The text shown in the document sidebar and in the next/previous button for this document. If this field is not present, the document's `sidebar_label` will default to its `title`.

For example:

```yaml
---
id: doc1
title: My Document
sidebar_label: Document
---
```

Versioned documents have their ids altered to include the version number when they get copied. The new `id` is `version-${version}-${id}` where `${version}` is the version number of that document and `${id}` is the original `id`. Additionally, versioned documents get an added `original_id` field with the original document id.

For example:

```yaml
---
id: version-1.0.0-doc1
title: My Document
sidebar_label: Document
original_id: doc1
---
```

`custom_edit_url`: The URL for editing this document. If this field is not present, the document's edit URL will fall back to `editUrl` from optional fields of `siteConfig.js`. See [siteConfig.js](site-config.md) docs for more information.

For example:

```yaml
---
id: doc-markdown
title: Markdown Features
custom_edit_url: https://github.com/facebook/Docusaurus/edit/master/docs/api-doc-markdown.md
---
```

### Blog Posts

Blog posts use the following markdown header fields that are enclosed by a line `---` on either side:

`title`: The title of this blog post.

`author`: The author of this blog post. If this field is omitted, no author name will be shown.

`authorURL`: A page to link to when a site user clicks the author's name. If this field is omitted, the author's name will not link to anything.

`authorFBID`: The author's Facebook id, used only to get the author's profile picture to display with the blog post. If this field is omitted, no author picture will be shown for the blog post.

For example:

```yaml
---
title: My First Blog Post
author: Frank Li
authorURL: http://twitter.com/franchementli
authorFBID: 100002976521003
---
```

## Extra Features

Docusaurus supports some extra features when writing documentation in markdown.

### Linking other Documents

You can use relative URLs to other documentation files which will automatically get converted to the corresponding HTML links when they get rendered.

Example:

```md
[This links to another document](other-document.md)
```

This markdown will automatically get converted into a link to `/docs/other-document.html` (or the appropriately translated/versioned link) once it gets rendered.

This can help when you want to navigate through docs on GitHub since the links there will be functional links to other documents (still on GitHub), but the documents will have the correct HTML links when they get rendered.

### Linking to Images and Other Assets

Static assets can be linked to in the same way that documents are, using relative URLs. Static assets used in documents and blogs should go into `docs/assets` and `website/blog/assets`, respectively. The markdown will get converted into correct link paths so that these paths will work for documents of all languages and versions.

Example:

```md
![alt-text](assets/doc-image.png)
```

### Generating Table of Contents

You can make an auto-generated list of links, which can be useful as a table of contents for API docs.

In your markdown file, insert a line with the text `<AUTOGENERATED_TABLE_OF_CONTENTS>`. Write your documentation using `h3` headers for each function inside a code block. These will be found by Docusaurus and a list of links to these sections will inserted at the text `<AUTOGENERATED_TABLE_OF_CONTENTS>`.

Example:

```md
### `docusaurus.function(a, b)`

Text describing my function

### `docdoc(file)`

Text describing my function
```

will lead to a table of contents of the functions:

```md
- `docusaurus.function(a, b)`
- `docdoc(file)`
```

and each function will link to their corresponding sections in the page.

## Syntax Highlighting

Syntax highlighting is enabled by default on fenced code blocks. The language should be detected automatically, but you can sometimes get better results by specifying the language. You can do so using an [info string](https://github.github.com/gfm/#example-111), following the three opening backticks. The following JavaScript example...

```js
ReactDOM.render(<h1>Hello, world!</h1>, document.getElementById('root'));
```

...would be rendered with syntax highlighting like so:

```js
ReactDOM.render(<h1>Hello, world!</h1>, document.getElementById('root'));
```

Highlighting is provided by [Highlight.js](https://highlightjs.org) using the theme specified in your `siteConfig.js` file as part of the `highlight` key:

```js
{
...
highlight: {
theme: 'default'
}
...
}
```

You can find the full list of supported themes in the Highlight.js [`styles`](https://github.com/isagalaev/highlight.js/tree/master/src/styles) directory.

### Registering additional languages

While Highlight.js provides support for [many popular languages out of the box](https://highlightjs.org/static/demo/), you may find the need to register additional language support. For these cases, we provide an escape valve by exposing the `hljs` constant as part of the `highlight` config key. This in turn allows you to call [`registerLanguage`](http://highlightjs.readthedocs.io/en/latest/api.html#registerlanguage-name-language):

```js
{
...
highlight: {
theme: 'default',
hljs: function(hljs) {
hljs.registerLanguage('galacticbasic', function(hljs) {
// ...
});
}
}
}
```

### Using Prism as additional syntax highlighter

You can also opt to use Prism to syntax highlight certain languages available in the list [here](https://github.com/PrismJS/prism/tree/master/components). Include those languages in `usePrism` field in your [siteConfig.js](api-site-config.md)

Example:

```
// siteConfig.js
usePrism: ['jsx']
```

Notice that the code block below uses JSX syntax highlighting from Prism.

```jsx
class Example extends React.Component {
render() {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text>Docusaurus</Text>
<Button
title="Click me"
onPress={() => this.props.navigation.push('Docusaurus')}
/>
</View>
);
}
}
```

### Adding Copy Code Buttons

Docusaurus allows for adding buttons to copy code within fenced code blocks. Please follow the instructions [here](https://gist.github.com/yangshun/55db997ed0f8f4e6527571fc3bee4675) to add "Copy" buttons to your code blocks.
Loading

0 comments on commit 0492ba5

Please sign in to comment.