Skip to content

Commit

Permalink
Merge branch 'main' of github.com:facebook/docusaurus into lex111/cod…
Browse files Browse the repository at this point in the history
…e-block-line-numbers
  • Loading branch information
lex111 committed Mar 25, 2022
2 parents 0de49c3 + 2964e6f commit e00a86c
Show file tree
Hide file tree
Showing 263 changed files with 3,464 additions and 3,015 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ module.exports = {
ERROR,
{'ts-expect-error': 'allow-with-description'},
],
'@typescript-eslint/consistent-indexed-object-style': [
WARNING,
'index-signature',
],
'@typescript-eslint/consistent-type-imports': [
WARNING,
{disallowTypeAnnotations: false},
Expand Down
219 changes: 219 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions admin/new.docusaurus.io/functionUtils/playgroundUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ const PlaygroundDocumentationUrl = 'https://docusaurus.io/docs/playground';
export type PlaygroundName = keyof typeof PlaygroundConfigs;

function isValidPlaygroundName(
playgroundName: string,
playgroundName: string | undefined,
): playgroundName is PlaygroundName {
return Object.keys(PlaygroundConfigs).includes(playgroundName);
return (
!!playgroundName && Object.keys(PlaygroundConfigs).includes(playgroundName)
);
}

export function createPlaygroundDocumentationResponse(): HandlerResponse {
Expand All @@ -54,10 +56,10 @@ export function createPlaygroundResponse(
}

// Inspired by https://stackoverflow.com/a/3409200/82609
function parseCookieString(cookieString: string): Record<string, string> {
const result: Record<string, string> = {};
function parseCookieString(cookieString: string): {[key: string]: string} {
const result: {[key: string]: string} = {};
cookieString.split(';').forEach((cookie) => {
const [name, value] = cookie.split('=');
const [name, value] = cookie.split('=') as [string, string];
result[name.trim()] = decodeURI(value);
});
return result;
Expand All @@ -66,7 +68,7 @@ function parseCookieString(cookieString: string): Record<string, string> {
export function readPlaygroundName(
event: HandlerEvent,
): PlaygroundName | undefined {
const parsedCookie: Record<string, string> = event.headers.cookie
const parsedCookie: {[key: string]: string} = event.headers.cookie
? parseCookieString(event.headers.cookie)
: {};
const playgroundName: string | undefined = parsedCookie[CookieName];
Expand Down
2 changes: 1 addition & 1 deletion admin/new.docusaurus.io/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.docusaurus.io",
"version": "2.0.0-beta.17",
"version": "2.0.0-beta.18",
"private": true,
"scripts": {
"start": "netlify dev"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ This is my **first Docusaurus document**!

It is also possible to create your sidebar explicitly in `sidebars.js`:

```diff title="sidebars.js"
```js title="sidebars.js"
module.exports = {
tutorialSidebar: [
{
type: 'category',
label: 'Tutorial',
- items: [...],
+ items: ['hello'],
// highlight-next-line
items: ['hello'],
},
],
};
Expand Down
16 changes: 8 additions & 8 deletions examples/classic-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"dev": "docusaurus start"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.17",
"@docusaurus/preset-classic": "2.0.0-beta.17",
"@docusaurus/core": "2.0.0-beta.18",
"@docusaurus/preset-classic": "2.0.0-beta.18",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"prism-react-renderer": "^1.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1"
"prism-react-renderer": "^1.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.17",
"@tsconfig/docusaurus": "^1.0.4",
"typescript": "^4.6.2"
"@docusaurus/module-type-aliases": "2.0.0-beta.18",
"@tsconfig/docusaurus": "^1.0.5",
"typescript": "^4.6.3"
},
"browserslist": {
"production": [
Expand Down
1,207 changes: 581 additions & 626 deletions examples/classic-typescript/yarn.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/classic/docs/tutorial-basics/create-a-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ This is my **first Docusaurus document**!

It is also possible to create your sidebar explicitly in `sidebars.js`:

```diff title="sidebars.js"
```js title="sidebars.js"
module.exports = {
tutorialSidebar: [
{
type: 'category',
label: 'Tutorial',
- items: [...],
+ items: ['hello'],
// highlight-next-line
items: ['hello'],
},
],
};
Expand Down
10 changes: 5 additions & 5 deletions examples/classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"dev": "docusaurus start"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.17",
"@docusaurus/preset-classic": "2.0.0-beta.17",
"@docusaurus/core": "2.0.0-beta.18",
"@docusaurus/preset-classic": "2.0.0-beta.18",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"prism-react-renderer": "^1.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1"
"prism-react-renderer": "^1.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"browserslist": {
"production": [
Expand Down
Loading

0 comments on commit e00a86c

Please sign in to comment.