Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: add command to run prettier on docs #2102

Merged
merged 4 commits into from
Dec 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ labels: 'bug, needs triage'

(Write your steps here:)

1.
1.
1.
1. Step 1...
1. Step 2...
1. Step 3...

## Expected behavior

Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ packages/docusaurus-plugin-content-docs/lib/
packages/docusaurus-plugin-content-pages/lib/
packages/docusaurus-plugin-sitemap/lib/
packages/docusaurus-plugin-ideal-image/lib/
__fixtures__
373 changes: 208 additions & 165 deletions CHANGELOG-2.x.md

Large diffs are not rendered by default.

50 changes: 29 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,55 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
## [1.14.3] - 2019-12-01

#### :bug: Bug Fix
* `docusaurus-1.x`
* [#2063](https://github.com/facebook/docusaurus/pull/2063) fix: transpile static js to IE 10 ([@JLHwung](https://github.com/JLHwung))

- `docusaurus-1.x`
- [#2063](https://github.com/facebook/docusaurus/pull/2063) fix: transpile static js to IE 10 ([@JLHwung](https://github.com/JLHwung))

#### :house: Internal
* `docusaurus-1.x`
* [#2029](https://github.com/facebook/docusaurus/pull/2029) chore: bump deps and remove unused deps ([@endiliey](https://github.com/endiliey))

- `docusaurus-1.x`
- [#2029](https://github.com/facebook/docusaurus/pull/2029) chore: bump deps and remove unused deps ([@endiliey](https://github.com/endiliey))

#### Committers: 2

- Endi ([@endiliey](https://github.com/endiliey))
- Huáng Jùnliàng ([@JLHwung](https://github.com/JLHwung))

## [1.14.2] - 2019-11-22

#### :bug: Bug Fix
* `docusaurus-1.x`
* [#2028](https://github.com/facebook/docusaurus/pull/2028) fix(v1): apply negative margin to docs heading only ([@yangshun](https://github.com/yangshun))

- `docusaurus-1.x`
- [#2028](https://github.com/facebook/docusaurus/pull/2028) fix(v1): apply negative margin to docs heading only ([@yangshun](https://github.com/yangshun))

#### :memo: Documentation
* [#2026](https://github.com/facebook/docusaurus/pull/2026) docs(v1): showcase user Channelize.io ([@gauravberiwal](https://github.com/gauravberiwal))

- [#2026](https://github.com/facebook/docusaurus/pull/2026) docs(v1): showcase user Channelize.io ([@gauravberiwal](https://github.com/gauravberiwal))

## [1.14.1] - 2019-11-21

#### :bug: Bug Fix
* [#2022](https://github.com/facebook/docusaurus/pull/2022) fix(v1): markdown content and toc should render the same ([@endiliey](https://github.com/endiliey))
* [#2020](https://github.com/facebook/docusaurus/pull/2020) fix(v1): docusaurus-start should work even if path contain 'pages' word ([@endiliey](https://github.com/endiliey))
* [#2019](https://github.com/facebook/docusaurus/pull/2019) fix(v1): consistent slug & hash-link generation ([@endiliey](https://github.com/endiliey))
* [#1869](https://github.com/facebook/docusaurus/pull/1869) fix(v1): fix page title render issue when referred by search result ([@parvezakkas](https://github.com/parvezakkas))
* [#1895](https://github.com/facebook/docusaurus/pull/1895) fix(v1): mobile safari search input misalignment in header ([@sarneeh](https://github.com/sarneeh))
* [#1871](https://github.com/facebook/docusaurus/pull/1871) misc(v1): use primary color for hovered items in table of contents ([@blitz137](https://github.com/blitz137))

- [#2022](https://github.com/facebook/docusaurus/pull/2022) fix(v1): markdown content and toc should render the same ([@endiliey](https://github.com/endiliey))
- [#2020](https://github.com/facebook/docusaurus/pull/2020) fix(v1): docusaurus-start should work even if path contain 'pages' word ([@endiliey](https://github.com/endiliey))
- [#2019](https://github.com/facebook/docusaurus/pull/2019) fix(v1): consistent slug & hash-link generation ([@endiliey](https://github.com/endiliey))
- [#1869](https://github.com/facebook/docusaurus/pull/1869) fix(v1): fix page title render issue when referred by search result ([@parvezakkas](https://github.com/parvezakkas))
- [#1895](https://github.com/facebook/docusaurus/pull/1895) fix(v1): mobile safari search input misalignment in header ([@sarneeh](https://github.com/sarneeh))
- [#1871](https://github.com/facebook/docusaurus/pull/1871) misc(v1): use primary color for hovered items in table of contents ([@blitz137](https://github.com/blitz137))

#### :house: Internal
* [#1920](https://github.com/facebook/docusaurus/pull/1920) misc(v1): use Node.js lts version for docker ([@gengjiawen](https://github.com/gengjiawen))

- [#1920](https://github.com/facebook/docusaurus/pull/1920) misc(v1): use Node.js lts version for docker ([@gengjiawen](https://github.com/gengjiawen))

#### :memo: Documentation
* [#1998](https://github.com/facebook/docusaurus/pull/1998) docs(v1): showcase user collective ([@kenning](https://github.com/kenning))
* [#1961](https://github.com/facebook/docusaurus/pull/1961) docs(v1): remove exclusive language ([@ericcarboni](https://github.com/ericcarboni))
* [#1873](https://github.com/facebook/docusaurus/pull/1873) docs: showcase user Amphora ([@xtellurian](https://github.com/xtellurian))
* [#1918](https://github.com/facebook/docusaurus/pull/1918) docs(v1): showcase user Reactive Interaction Gateway ([@mmacai](https://github.com/mmacai))
* [#1911](https://github.com/facebook/docusaurus/pull/1911) docs: updating configcat user link ([@mr-sige](https://github.com/mr-sige))
* [#1902](https://github.com/facebook/docusaurus/pull/1902) misc: update URLs to non-HTML versions ([@ikrydev](https://github.com/ikrydev))
* [#1901](https://github.com/facebook/docusaurus/pull/1901) docs(v1): remove broken link for user Vasern ([@ikrydev](https://github.com/ikrydev))

- [#1998](https://github.com/facebook/docusaurus/pull/1998) docs(v1): showcase user collective ([@kenning](https://github.com/kenning))
- [#1961](https://github.com/facebook/docusaurus/pull/1961) docs(v1): remove exclusive language ([@ericcarboni](https://github.com/ericcarboni))
- [#1873](https://github.com/facebook/docusaurus/pull/1873) docs: showcase user Amphora ([@xtellurian](https://github.com/xtellurian))
- [#1918](https://github.com/facebook/docusaurus/pull/1918) docs(v1): showcase user Reactive Interaction Gateway ([@mmacai](https://github.com/mmacai))
- [#1911](https://github.com/facebook/docusaurus/pull/1911) docs: updating configcat user link ([@mr-sige](https://github.com/mr-sige))
- [#1902](https://github.com/facebook/docusaurus/pull/1902) misc: update URLs to non-HTML versions ([@ikrydev](https://github.com/ikrydev))
- [#1901](https://github.com/facebook/docusaurus/pull/1901) docs(v1): remove broken link for user Vasern ([@ikrydev](https://github.com/ikrydev))

## [1.14.0] - 2019-10-20

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

The [Open Source Guides](https://opensource.guide/) website has a collection of resources for individuals, communities, and companies who want to learn how to run and contribute to an open source project. Contributors and people new to open source alike will find the following guides especially useful:

* [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
* [Building Welcoming Communities](https://opensource.guide/building-community/)
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
- [Building Welcoming Communities](https://opensource.guide/building-community/)

## [Code of Conduct](https://code.fb.com/codeofconduct)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Read our [contributing guide](https://github.com/facebook/docusaurus/blob/master

### 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](https://github.com/facebook/docusaurus/labels/good%20first%20issue) that might contain smaller issues to tackle first. This is a great place to get started.
To help you get your feet wet and get you familiar with our contribution process, we have a list of [beginner friendly bugs](https://github.com/facebook/docusaurus/labels/good%20first%20issue) that might contain smaller issues to tackle first. This is a great place to get started.

## Contact

Expand Down
41 changes: 36 additions & 5 deletions admin/extending-remarkable.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,35 @@ md.renderer.rules.heading_close = function(tokens, idx /*, options, env */) {
That's pretty straightforward: whenever these tokens are found, we render a `<hN>` or `</hN>` HTML tag, where N is the `hLevel` for this heading. That would result in `<h3>Hi there</h3>` being output. But what we want is something closer to this:

```html
<h3><a class="anchor" id="hi-there"></a>Hi there <a class="hash-link" href="#hi-there">#</a></h3>
<h3>
<a class="anchor" id="hi-there"></a>Hi there
<a class="hash-link" href="#hi-there">#</a>
</h3>
```

In that case, we need to override our heading rules like so:

```js
md.renderer.rules.heading_open = function(tokens, idx /*, options, env */) {
return '<h' + tokens[idx].hLevel + '>' + '<a class="anchor" id="' + toSlug(tokens[idx+1].content) + '"></a>';
return (
'<h' +
tokens[idx].hLevel +
'>' +
'<a class="anchor" id="' +
toSlug(tokens[idx + 1].content) +
'"></a>'
);
};

md.renderer.rules.heading_close = function(tokens, idx /*, options, env */) {
return ' <a class="hash-link" href="#' + toSlug(tokens[idx-1].content) + '">#</a>' + '</h' + tokens[idx].hLevel + '>\n';
return (
' <a class="hash-link" href="#' +
toSlug(tokens[idx - 1].content) +
'">#</a>' +
'</h' +
tokens[idx].hLevel +
'>\n'
);
};
```

Expand All @@ -89,11 +106,25 @@ We now need to tell Remarkable to use our extension. We can wrap our rules in a
```js
function anchors(md) {
md.renderer.rules.heading_open = function(tokens, idx /*, options, env */) {
return '<h' + tokens[idx].hLevel + '>' + '<a class="anchor" id="' + toSlug(tokens[idx+1].content) + '"></a>';
return (
'<h' +
tokens[idx].hLevel +
'>' +
'<a class="anchor" id="' +
toSlug(tokens[idx + 1].content) +
'"></a>'
);
};

md.renderer.rules.heading_close = function(tokens, idx /*, options, env */) {
return ' <a class="hash-link" href="#' + toSlug(tokens[idx-1].content) + '">#</a>' + '</h' + tokens[idx].hLevel + '>\n';
return (
' <a class="hash-link" href="#' +
toSlug(tokens[idx - 1].content) +
'">#</a>' +
'</h' +
tokens[idx].hLevel +
'>\n'
);
};
}
```
Expand Down
2 changes: 1 addition & 1 deletion admin/prerelease.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ $ git fetch upstream && git checkout master && git merge upstream/master
3. Run `bash scripts/prerelease.sh`.
4. Create your pull request on GitHub.

<img width="629" alt="pull request" src="https://user-images.githubusercontent.com/17883920/43393765-ccb050ac-942a-11e8-94e8-d585034fa064.PNG">
<img width="629" alt="pull request" src="https://user-images.githubusercontent.com/17883920/43393765-ccb050ac-942a-11e8-94e8-d585034fa064.PNG">
38 changes: 19 additions & 19 deletions docs/api-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ title: CLI Commands

Docusaurus provides a set of scripts to help you generate, serve, and deploy your website. These scripts can be invoked with the `run` command when using Yarn or npm. Some common commands are:

* [`yarn run start`](api-commands.md#docusaurus-start-port-number): build and serve the website from a local server
* [`yarn run examples`](api-commands.md#docusaurus-examples): create example configuration files
- [`yarn run start`](api-commands.md#docusaurus-start-port-number): build and serve the website from a local server
- [`yarn run examples`](api-commands.md#docusaurus-examples): create example configuration files

## Running from the command line

Expand Down Expand Up @@ -56,10 +56,10 @@ Docusaurus provides some default mappings to allow you to run commands following

Alias: `build`.

| Options | Default | Description |
| -------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------- |
| Options | Default | Description |
| --- | --- | --- |
| `--skip-image-compression` | `false` | Skip compression of image assets. You usually won't want to skip this unless your images have already been optimized. |
| `--skip-next-release` | `false` | Skip the next release documents when versioning is enabled. This will not build HTML files for documents in `/docs` directory.|
| `--skip-next-release` | `false` | Skip the next release documents when versioning is enabled. This will not build HTML files for documents in `/docs` directory. |

Generates the static website, applying translations if necessary. Useful for building the website prior to deployment.

Expand All @@ -71,9 +71,9 @@ See also [`docusaurus-start`](api-commands.md#docusaurus-start).

Alias: `examples`

| Arguments | Default | Description |
| ----------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `<feature>` | - | Specify a feature `translations` or `versions` to generate the extra example files for that feature. |
| Arguments | Default | Description |
| --- | --- | --- |
| `<feature>` | - | Specify a feature `translations` or `versions` to generate the extra example files for that feature. |

**Example**

Expand All @@ -93,8 +93,8 @@ Alias: `publish-gh-pages`

The following environment variables are generally set manually by the user in the CircleCI `config.yml` file.

* `GIT_USER`: The git user to be associated with the deploy commit.
* `USE_SSH`: Whether to use SSH instead of HTTPS for your connection to the GitHub repo.
- `GIT_USER`: The git user to be associated with the deploy commit.
- `USE_SSH`: Whether to use SSH instead of HTTPS for your connection to the GitHub repo.

**Example**

Expand All @@ -104,13 +104,13 @@ GIT_USER=docusaurus-bot USE_SSH=true yarn run publish-gh-pages

The following environment variables are [set by CircleCI](https://circleci.com/docs/1.0/environment-variables/) during the build process.

* `CIRCLE_BRANCH`: The git branch associated with the commit that triggered the CI run.
* `CI_PULL_REQUEST`: Expected to be truthy if the current CI run was triggered by a commit in a pull request.
- `CIRCLE_BRANCH`: The git branch associated with the commit that triggered the CI run.
- `CI_PULL_REQUEST`: Expected to be truthy if the current CI run was triggered by a commit in a pull request.

The following should be set by you in `siteConfig.js` as `organizationName` and `projectName`, respectively. If they are not set in your site configuration, they fall back to the [CircleCI environment](https://circleci.com/docs/1.0/environment-variables/).

* `CIRCLE_PROJECT_USERNAME`: The GitHub username or organization name that hosts the Git repo, e.g. "facebook".
* `CIRCLE_PROJECT_REPONAME`: The name of the Git repo, e.g. "Docusaurus".
- `CIRCLE_PROJECT_USERNAME`: The GitHub username or organization name that hosts the Git repo, e.g. "facebook".
- `CIRCLE_PROJECT_REPONAME`: The name of the Git repo, e.g. "Docusaurus".

You can learn more about configuring automatic deployments with CircleCI in the [Publishing guide](getting-started-publishing.md).

Expand Down Expand Up @@ -143,11 +143,11 @@ Alias: `start`.

This command will build the static website, apply translations if necessary, and then start a local server.

| Options | Default | Description |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `--port <number>` | `3000` | The website will be served from port 3000 by default, but if the port is taken up, Docusaurus will attempt to find an available one. |
|`--host <host>`|`localhost`|Specify a host to use. E.g., if you want your server to be accessible externally, you can use --host 0.0.0.0.|
| `--watch` | - | Whether to watch the files and live reload the page when files are changed. Defaults to true. Disable this by using `--no-watch`. |
| Options | Default | Description |
| --- | --- | --- |
| `--port <number>` | `3000` | The website will be served from port 3000 by default, but if the port is taken up, Docusaurus will attempt to find an available one. |
| `--host <host>` | `localhost` | Specify a host to use. E.g., if you want your server to be accessible externally, you can use --host 0.0.0.0. |
| `--watch` | - | Whether to watch the files and live reload the page when files are changed. Defaults to true. Disable this by using `--no-watch`. |

You can specify the browser application to be opened by setting the `BROWSER` environment variable before the command, e.g.:

Expand Down
13 changes: 10 additions & 3 deletions docs/api-doc-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ 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.
Expand All @@ -38,6 +39,7 @@ 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](api-site-config.md) docs for more information.
Expand All @@ -50,6 +52,7 @@ id: doc-markdown
title: Markdown Features
custom_edit_url: https://github.com/facebook/docusaurus/edit/master/docs/api-doc-markdown.md
---

```

### Blog Posts
Expand All @@ -73,6 +76,7 @@ author: Frank Li
authorURL: http://twitter.com/franchementli
authorFBID: 100002976521003
---

```

## Extra Features
Expand Down Expand Up @@ -130,7 +134,6 @@ will lead to a table of contents of the functions:

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


### Language-specific Code Tabs

Display code in multiple programming languages using code tabs. First, mark the start and end of a code tabs group, by using `<!-- DOCUSAURUS_CODE_TABS -->` and `<!-- END_DOCUSAURUS_CODE_TABS -->` respectively in your markdown. Then start each tab with `<!--[TAB_TITLE]-->`.
Expand All @@ -144,26 +147,30 @@ produces this:
<!--DOCUSAURUS_CODE_TABS-->

<!--JavaScript-->

```js
console.log('Hello, world!');
```

<!--Python-->

```py
print('Hello, world!')
```

<!--C-->

```C
#include <stdio.h>

int main() {
printf("Hello World!");
return 0;
printf("Hello World!");
return 0;
}
```

<!--Pascal-->

```Pascal
program HelloWorld;
begin
Expand Down
Loading