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

feat(v2): highlight items in the table of content #1896

Merged
merged 47 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
19efb7c
feat(v2): highlight items in the table of content
Oct 27, 2019
4f44e36
refactor: move string to const
Oct 27, 2019
c23f981
refactor(v2): Convert sitemap plugin to TypeScript (#1894)
moozzyk Oct 27, 2019
fabaf77
perf(v2): significantly reduce bundle size & initial html payload (#1…
endiliey Oct 27, 2019
84462e2
fix(v2): align search icon on small width device (#1893)
endiliey Oct 27, 2019
01f4d9a
refactor(v2): refactor dark toggle into a hook (#1899)
wgao19 Oct 27, 2019
98679b5
perf(v2): reduce memory usage consumption (#1900)
endiliey Oct 27, 2019
f14b6ee
misc(v1): use primary color for hovered items in table of contents (#…
blitz137 Oct 27, 2019
421598e
fix(v1): mobile safari search input misalignment in header (#1895)
jsardev Oct 27, 2019
812a30b
misc(v2): v1 backward compatibility for USE_SSH env var (#1880)
yns88 Oct 27, 2019
9c69dfd
feat(v2): allow line highlighting (#1860)
lex111 Oct 27, 2019
3172602
docs(v1): remove user Vasern (#1901)
ikrydev Oct 28, 2019
3f4c805
misc: update URLs to non-HTML versions (#1902)
ikrydev Oct 28, 2019
b6667a0
misc(v2): improve index page SEO score
yangshun Oct 28, 2019
7714afb
fix(v2): accessing /docs or /docs/xxxx should not be empty (#1903)
endiliey Oct 28, 2019
f635f9a
docs(v2): code block line highlighting (#1904)
yangshun Oct 29, 2019
e6444c0
fix(v2): webpack modules resolve should prioritize @docusaurus/core o…
endiliey Oct 29, 2019
2e58e83
feat(v2): simplify blog metadata to minimize number of request (#1908)
endiliey Oct 29, 2019
31d17c9
feat(v2): add ability to set custom HTML in footer items (#1905)
lex111 Oct 29, 2019
ad22c9f
docs: update configcat user link (#1911)
mr-sige Oct 29, 2019
a8826b9
fix(v2): docs plugin stability improvement (100% test coverage) (#1912)
endiliey Oct 29, 2019
f853171
docs(v2): add windows batch instructions for publishing to gh pages (…
dylmye Oct 29, 2019
64871b7
fix(v2): custom searchbar should appear even if themeconfig.algolia i…
endiliey Oct 30, 2019
6fcee6d
fix(v2): missing/hidden algolia search suggestion result (#1915)
endiliey Oct 30, 2019
16f10dd
docs(v2): Redirect component for easy redirect (#1913)
endiliey Oct 30, 2019
5a2f539
refactor: changes after comments (use custom hooks, code changes, fix…
Oct 30, 2019
ca4efb6
fix(v2): regression from prioritizing core node_modules logic (#1917)
endiliey Oct 30, 2019
c7ff07c
chore: changelog
endiliey Oct 30, 2019
255584c
docs(v1): showcase user Reactive Interaction Gateway (#1918)
mmacai Oct 30, 2019
ab15205
chore: bump dependencies
endiliey Oct 31, 2019
472c8fc
docs(v2): fix typo in advanced plugins (#1926)
joelibaceta Nov 1, 2019
b8335fe
docs(v2): fix typos (#1930)
lex111 Nov 2, 2019
0baaad3
docs(v1): fix links in CHANGELOG (#1931)
glenwinters Nov 2, 2019
c41c19e
fix(v2): @theme/heading should not create anchor if id is not defined…
endiliey Nov 2, 2019
3f8cb78
docs(v2): theme, plugin, and preset config (#1929)
kabartolo Nov 3, 2019
82ece51
misc: use /usr/bin/env bash to increase portability (#1923)
marcjansen Nov 3, 2019
33718b6
misc(v1): use Node.js lts version (#1920)
gengjiawen Nov 3, 2019
2d13fe2
chore: downgrade imagemin (#1933)
endiliey Nov 3, 2019
34a84a3
fix(v2): add missing key prop in footer items with HTML (#1935)
lex111 Nov 3, 2019
146a301
fix(v2): fix browser window background (#1936)
lex111 Nov 4, 2019
9c34bb7
fix(v2): allows to create tabs with only one item (#1934)
Nov 4, 2019
0d445fc
fix(v2): remove redundant npm script in classic template (#1937)
lex111 Nov 4, 2019
cd9e2f2
v2.0.0-alpha.32
endiliey Nov 4, 2019
5909b49
chore(v2): changelog
endiliey Nov 4, 2019
32773e5
Merge branch 'feat/1752' of https://github.com/SantiagoGdaR/docusauru…
yangshun Nov 5, 2019
77e8890
misc(v2): update TOC highlight
yangshun Nov 5, 2019
542b7c9
misc(v2): update CHANGELOG
yangshun Nov 5, 2019
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ packages/docusaurus-init/lib/
packages/docusaurus-plugin-content-blog/lib/
packages/docusaurus-plugin-content-docs/lib/
packages/docusaurus-plugin-content-pages/lib/
packages/docusaurus-plugin-sitemap/lib/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ packages/docusaurus-init/lib/
packages/docusaurus-plugin-content-blog/lib/
packages/docusaurus-plugin-content-docs/lib/
packages/docusaurus-plugin-content-pages/lib/
packages/docusaurus-plugin-sitemap/lib/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ packages/docusaurus-init/lib/
packages/docusaurus-plugin-content-blog/lib/
packages/docusaurus-plugin-content-docs/lib/
packages/docusaurus-plugin-content-pages/lib/
packages/docusaurus-plugin-sitemap/lib/
64 changes: 57 additions & 7 deletions CHANGELOG-2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,66 @@

## Unreleased

- Add table of contents highlighting on scroll.

## 2.0.0-alpha.32

### Features

- Add `<Redirect>` component for easy client side redirect. Example Usage:

```js
import React from 'react';
import {Redirect} from '@docusaurus/router';

function Home() {
return <Redirect to="/docs/test" />;
}
```

- Allow user to add custom HTML to footer items. [#1905](https://github.com/facebook/docusaurus/pull/1905)
- Added code block line highlighting feature (thanks @lex111)! If you have previously swizzled the `CodeBlock` theme component, it is recommended to update your source code to have this feature. ([#1860](https://github.com/facebook/Docusaurus/issues/1860))

### Bug Fixes

- Fix `@theme/Tabs` component to be able to create tabs with only one item.
- Fix MDX `@theme/Heading` component. If there is no id, it should not create anchor link.
- Fixed a bug in which if `themeConfig.algolia` is not defined, the custom searchbar won't appear. If you've swizzled Algolia `SearchBar` component before, please update your source code otherwise CSS might break. See [#1909](https://github.com/facebook/docusaurus/pull/1909/files) for reference.

```js
- <Fragment>
+ <div className="navbar__search" key="search-box">
```

- Slightly adjust search icon position to be more aligned on small width device. ([#1893](https://github.com/facebook/Docusaurus/issues/1893))
- Fix algolia styling bug, previously search suggestion result is sometimes hidden. ([#1915](https://github.com/facebook/Docusaurus/issues/1915))
- Changed the way we read the `USE_SSH` env variable during deployment to be the same as in v1.
- Fix accessing `docs/` or `/docs/xxxx` that does not match any existing doc page should return 404 (Not found) page, not blank page. ([#1903](https://github.com/facebook/Docusaurus/issues/1903))
- Prioritize `@docusaurus/core` dependencies/ node_modules over user's node_modules. This fix a bug whereby if user has core-js@3 on its own node_modules but docusaurus depends on core-js@2, we previously encounter `Module not found: core-js/modules/xxxx` (because core-js@3 doesn't have that).
- Fix a bug where docs plugin add `/docs` route even if docs folder is empty. We also improved docs plugin test coverage to 100% for stability before working on docs versioning. ([#1912](https://github.com/facebook/Docusaurus/issues/1912))

### Performance Improvement

- Reduce memory usage consumption. ([#1900](https://github.com/facebook/Docusaurus/issues/1900))
- Significantly reduce main bundle size and initial HTML payload on production build. Generated files from webpack is also shorter in name. ([#1898](https://github.com/facebook/Docusaurus/issues/1898))
- Simplify blog metadata. Previously, accessing `/blog/post-xxx` will request for next and prev blog post metadata too aside from target post metadata. We should only request target post metadata. ([#1908](https://github.com/facebook/Docusaurus/issues/1908))

### Others

- Convert sitemap plugin to TypeScript. ([#1894](https://github.com/facebook/Docusaurus/issues/1894))
- Refactor dark mode toggle into a hook. ([#1899](https://github.com/facebook/Docusaurus/issues/1899))

## 2.0.0-alpha.31

- Footer is now sticky/ pinned to the bottom of the viewport in desktop browsers.
- Footer is now sticky/ pinned to the bottom of the viewport in desktop browsers.
- Footer is now also displayed in docs page for consistency.
- Remove empty doc sidebar container if sidebar for a particular doc page does not exist. Otherwise, it will cause an additional empty space.
- Default PostCSS loader now only polyfills stage 3+ features (previously it was stage 2) like Create React App. Stage 2 CSS is considered relatively unstable and subject to change while Stage 3 features will likely become a standard.
- Default PostCSS loader now only polyfills stage 3+ features (previously it was stage 2) like Create React App. Stage 2 CSS is considered relatively unstable and subject to change while Stage 3 features will likely become a standard.
- Fix search bar focus bug. When you put the focus on search input, previously the focus will remain although we have clicked to other area outside of the search input.
- New themeConfig option `sidebarCollapsible`. It is on by default. If explicitly set to `false`, all doc items in sidebar is expanded. Otherwise, it will still be a collapsible sidebar.
- Disable adding hashes to the generated class names of CSS modules in dev mode. Generating unique identifiers takes some time, which can be saved since including paths to files in class names is enough to avoid collisions.
- Fix showing sidebar category with empty items.
- Update infima from 0.2.0-alpha.2 to 0.2.0-alpha.3
- Fix showing sidebar category with empty items.
- Fix pagination nav and right sidebar color contrast ratio
- Fix sidebar arrow color in dark mode
- Fix footer mobile issue
Expand All @@ -23,11 +72,12 @@

- Fix babel transpilation include/exclude logic to be more efficient. This also fix a very weird bug `TypeError: Cannot assign to read only property 'exports' of object '#<Object>'`.([#1868](https://github.com/facebook/docusaurus/pull/1868))

If you are still encountering the error. Please check whether you use `module.exports` for your `.js` file instead of doing `export` (mixing CJS and ES). See https://github.com/webpack/webpack/issues/4039#issuecomment-477779322 and https://github.com/webpack/webpack/issues/4039#issuecomment-273804003 for more context.
If you are still encountering the error. Please check whether you use `module.exports` for your `.js` file instead of doing `export` (mixing CJS and ES). See https://github.com/webpack/webpack/issues/4039#issuecomment-477779322 and https://github.com/webpack/webpack/issues/4039#issuecomment-273804003 for more context.

## 2.0.0-alpha.29

**HOTFIX for 2.0.0-alpha.28**.
**HOTFIX for 2.0.0-alpha.28**.

- Fix missing `core-js` dependencies on `@docusaurus/core`.
- Fix wrong `@babel/env` preset configuration that causes build compilation error.
- New UI for webpack compilation progress bar.
Expand All @@ -42,7 +92,7 @@ If you are still encountering the error. Please check whether you use `module.ex
- Fix logo URL in footer to be appended with baseUrl automatically.
- Add the option `--no-open` for `start` command.
- Set `@babel/env` useBuiltins to `usage`. This will automatically use browserlist and import polyfills required.
- Modified TerserWebpackPlugin `terserOptions` for better cross-browser compatibility.
- Modified TerserWebpackPlugin `terserOptions` for better cross-browser compatibility.
- **BREAKING** `withBaseUrl` is renamed to `useBaseUrl` because its a React Hooks. Make sure you import/rename it correctly. Eg: `import useBaseUrl from '@docusaurus/useBaseUrl`;
- Fix potential security vulnerability because we're exposing the directory structure of the host machine.
- Upgrade dependencies.
Expand All @@ -52,7 +102,7 @@ If you are still encountering the error. Please check whether you use `module.ex
- Add `@theme/Tabs` which can be used to implement multi-language code tabs.
- Implement `custom_edit_url` and `hide_title` markdown header for docusaurus v1 feature parity.
- Reduce memory usage and slightly faster production build.
- Misc dependency upgrades.
- Misc dependency upgrades.

## 2.0.0-alpha.26

Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

**Docs**

- docs: document docker is optional ([#1848])(https://github.com/facebook/docusaurus/pull/1848)
- docs: document docker is optional ([#1848](https://github.com/facebook/docusaurus/pull/1848))

## [1.13.0] - 2019-09-15

Expand Down Expand Up @@ -1178,7 +1178,8 @@ N/A
- Blog
- Documentation

[unreleased]: https://github.com/facebook/docusaurus/compare/v1.13.0...HEAD
[unreleased]: https://github.com/facebook/docusaurus/compare/v1.14.0...HEAD
[1.14.0]: https://github.com/facebook/docusaurus/compare/v1.13.0...v1.14.0
[1.13.0]: https://github.com/facebook/docusaurus/compare/v1.12.0...v1.13.0
[1.12.0]: https://github.com/facebook/docusaurus/compare/v1.11.1...v1.12.0
[1.11.1]: https://github.com/facebook/docusaurus/compare/v1.11.0...v1.11.1
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

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).
- **Simple to Start** Docusaurus is built to be easy to [get up and running](https://docusaurus.io/docs/en/installation/) 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/) 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/adding-blog/), and additional support pages, it is also [customizable](https://docusaurus.io/docs/en/custom-pages/) as well to ensure you have a site that is [uniquely yours](https://docusaurus.io/docs/en/api-pages/).

## Installation

Docusaurus is available as the [`docusaurus` package](https://www.npmjs.com/package/docusaurus) on [npm](https://www.npmjs.com).

We have also released the [`docusaurus-init` package](https://www.npmjs.com/package/docusaurus-init) to make [getting started](https://docusaurus.io/docs/en/installation.html) with Docusaurus even easier.
We have also released the [`docusaurus-init` package](https://www.npmjs.com/package/docusaurus-init) to make [getting started](https://docusaurus.io/docs/en/installation/) with Docusaurus even easier.

## Contributing

Expand Down
6 changes: 6 additions & 0 deletions docs/getting-started-publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,19 @@ __Note:__ Not setting the `url` and `baseUrl` of your project might result in in

To run the script directly from the command-line, you can use the following, filling in the parameter values as appropriate.

**Bash**
```bash
GIT_USER=<GIT_USER> \
CURRENT_BRANCH=master \
USE_SSH=true \
yarn run publish-gh-pages # or `npm run publish-gh-pages`
```

**Windows**
```batch
cmd /C "set GIT_USER=<GIT_USER> && set CURRENT_BRANCH=master && set USE_SSH=true && yarn run publish-gh-pages"
```

There are also two optional parameters that are set as environment variables:

| Name | Description |
Expand Down
21 changes: 12 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@

const path = require('path');

const ignorePatterns = [
'/node_modules/',
'__fixtures__',
'/packages/docusaurus/lib',
'/packages/docusaurus-utils/lib',
'/packages/docusaurus-plugin-content-blog/lib',
'/packages/docusaurus-plugin-content-docs/lib',
'/packages/docusaurus-plugin-content-pages/lib',
];

module.exports = {
rootDir: path.resolve(__dirname),
verbose: true,
testURL: 'http://localhost/',
testEnvironment: 'node',
testPathIgnorePatterns: [
'/node_modules/',
'__fixtures__',
'/packages/docusaurus/lib',
'/packages/docusaurus-utils/lib',
'/packages/docusaurus-plugin-content-blog/lib',
'/packages/docusaurus-plugin-content-docs-legacy/lib',
'/packages/docusaurus-plugin-content-pages/lib',
],
testPathIgnorePatterns: ignorePatterns,
coveragePathIgnorePatterns: ignorePatterns,
transform: {
'^.+\\.[jt]sx?$': 'babel-jest',
},
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "3.14.1",
"version": "2.0.0-alpha.31",
"version": "2.0.0-alpha.32",
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion packages/docusaurus-1.x/examples/basics/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8.11.4
FROM node:lts

WORKDIR /app/website

Expand Down

This file was deleted.

125 changes: 0 additions & 125 deletions packages/docusaurus-1.x/lib/core/__tests__/anchors.test.js

This file was deleted.

7 changes: 5 additions & 2 deletions packages/docusaurus-1.x/lib/core/renderMarkdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

const _ = require('lodash');
const hljs = require('highlight.js');
const Markdown = require('remarkable');
const {Remarkable: Markdown} = require('remarkable');
const {linkify} = require('remarkable/linkify');
const prismjs = require('prismjs');
const loadLanguages = require('prismjs/components/index');
const chalk = require('chalk');
Expand Down Expand Up @@ -83,7 +84,6 @@ class MarkdownRenderer {
return '';
},
html: true,
linkify: true,
};

// Allow overriding default options
Expand All @@ -100,6 +100,9 @@ class MarkdownRenderer {
// Register anchors plugin
md.use(anchors);

// Linkify
md.use(linkify);

// Allow client sites to register their own plugins
if (siteConfig.markdownPlugins) {
siteConfig.markdownPlugins.forEach(plugin => {
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-1.x/lib/core/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

const Remarkable = require('remarkable');
const {Remarkable} = require('remarkable');
const mdToc = require('markdown-toc');
const striptags = require('striptags');
const toSlug = require('./toSlug');
Expand Down
Loading