mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-31 01:47:17 +02:00
misc: add command to run prettier on docs (#2102)
* misc: add command to run prettier on docs * Fix GH issue template * Fix tests * Add prettier-docs command to precommit
This commit is contained in:
parent
cfc313d7c7
commit
55e676cb25
141 changed files with 1181 additions and 968 deletions
|
@ -1,20 +1,35 @@
|
|||
## foo
|
||||
|
||||
### foo
|
||||
|
||||
### foo 1
|
||||
|
||||
## foo 1
|
||||
|
||||
## foo 2
|
||||
|
||||
### foo
|
||||
|
||||
#### 4th level headings
|
||||
|
||||
All 4th level headings should not be shown by default
|
||||
|
||||
## bar
|
||||
|
||||
### bar
|
||||
|
||||
#### bar
|
||||
4th level heading should be ignored by default, but is should be always taken
|
||||
into account, when generating slugs
|
||||
|
||||
4th level heading should be ignored by default, but is should be always taken into account, when generating slugs
|
||||
|
||||
### `bar`
|
||||
|
||||
#### `bar`
|
||||
|
||||
## bar
|
||||
|
||||
### bar
|
||||
|
||||
#### bar
|
||||
|
||||
## bar
|
||||
|
|
|
@ -25,4 +25,4 @@ Alias: `bag`
|
|||
|
||||
### `pokemon-rename`
|
||||
|
||||
Alias: `rename`
|
||||
Alias: `rename`
|
||||
|
|
|
@ -1,24 +1,29 @@
|
|||
<!--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
|
||||
|
|
|
@ -188,24 +188,39 @@ Array [
|
|||
|
||||
exports[`insertTOC AUTOGENERATED_TABLE_OF_CONTENTS does not exist 1`] = `
|
||||
"## foo
|
||||
|
||||
### foo
|
||||
|
||||
### foo 1
|
||||
|
||||
## foo 1
|
||||
|
||||
## foo 2
|
||||
|
||||
### foo
|
||||
|
||||
#### 4th level headings
|
||||
|
||||
All 4th level headings should not be shown by default
|
||||
|
||||
## bar
|
||||
|
||||
### bar
|
||||
|
||||
#### bar
|
||||
4th level heading should be ignored by default, but is should be always taken
|
||||
into account, when generating slugs
|
||||
|
||||
4th level heading should be ignored by default, but is should be always taken into account, when generating slugs
|
||||
|
||||
### \`bar\`
|
||||
|
||||
#### \`bar\`
|
||||
|
||||
## bar
|
||||
|
||||
### bar
|
||||
|
||||
#### bar
|
||||
|
||||
## bar
|
||||
"
|
||||
`;
|
||||
|
@ -237,5 +252,6 @@ Alias: \`bag\`
|
|||
|
||||
### \`pokemon-rename\`
|
||||
|
||||
Alias: \`rename\`"
|
||||
Alias: \`rename\`
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -39,33 +39,33 @@ describe('when code tabs are used correctly', () => {
|
|||
it('renders tabs correctly', () => {
|
||||
const node = page.getDOMNode();
|
||||
const firstTab = node.querySelector('[data-tab$="-content-2"]').textContent;
|
||||
expect('JavaScript').toEqual(firstTab);
|
||||
expect(firstTab).toEqual('JavaScript');
|
||||
const secondTab = node.querySelector('[data-tab$="-content-3"]')
|
||||
.textContent;
|
||||
expect('Python').toEqual(secondTab);
|
||||
expect(secondTab).toEqual('Python');
|
||||
const thirdTab = node.querySelector('[data-tab$="-content-4"]').textContent;
|
||||
expect('C').toEqual(thirdTab);
|
||||
expect(thirdTab).toEqual('C');
|
||||
const fourthTab = node.querySelector('[data-tab$="-content-5"]')
|
||||
.textContent;
|
||||
expect('Pascal').toEqual(fourthTab);
|
||||
expect(fourthTab).toEqual('Pascal');
|
||||
});
|
||||
it('renders content correctly', () => {
|
||||
const node = page.getDOMNode();
|
||||
const firstContent = node.querySelector('[id$="-content-2"] code')
|
||||
.textContent;
|
||||
expect("console.log('Hello, world!');").toEqual(firstContent);
|
||||
expect(firstContent).toEqual("console.log('Hello, world!');");
|
||||
const secondContent = node.querySelector('[id$="-content-3"] code')
|
||||
.textContent;
|
||||
expect("print('Hello, world!')").toEqual(secondContent);
|
||||
expect(secondContent).toEqual("print('Hello, world!')");
|
||||
const thirdContent = node.querySelector('[id$="-content-4"] code')
|
||||
.textContent;
|
||||
expect(
|
||||
'#include <stdio.h>int main() { printf("Hello World!"); return 0;}',
|
||||
).toEqual(thirdContent);
|
||||
expect(thirdContent).toEqual(
|
||||
'#include <stdio.h>int main() { printf("Hello World!"); return 0;}',
|
||||
);
|
||||
const fourthContent = node.querySelector('[id$="-content-5"] code')
|
||||
.textContent;
|
||||
expect("program HelloWorld;begin WriteLn('Hello, world!');end.").toEqual(
|
||||
fourthContent,
|
||||
expect(fourthContent).toEqual(
|
||||
"program HelloWorld;begin WriteLn('Hello, world!');end.",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -92,33 +92,33 @@ describe('when code tab is used in a list', () => {
|
|||
it('renders tabs correctly', () => {
|
||||
const node = page.getDOMNode();
|
||||
const firstTab = node.querySelector('[data-tab$="-content-2"]').textContent;
|
||||
expect('JavaScript').toEqual(firstTab);
|
||||
expect(firstTab).toEqual('JavaScript');
|
||||
const secondTab = node.querySelector('[data-tab$="-content-3"]')
|
||||
.textContent;
|
||||
expect('Python').toEqual(secondTab);
|
||||
expect(secondTab).toEqual('Python');
|
||||
const thirdTab = node.querySelector('[data-tab$="-content-4"]').textContent;
|
||||
expect('C').toEqual(thirdTab);
|
||||
expect(thirdTab).toEqual('C');
|
||||
const fourthTab = node.querySelector('[data-tab$="-content-5"]')
|
||||
.textContent;
|
||||
expect('Pascal').toEqual(fourthTab);
|
||||
expect(fourthTab).toEqual('Pascal');
|
||||
});
|
||||
it('renders content correctly', () => {
|
||||
const node = page.getDOMNode();
|
||||
const firstContent = node.querySelector('[id$="-content-2"] code')
|
||||
.textContent;
|
||||
expect("console.log('Hello, world!');").toEqual(firstContent);
|
||||
expect(firstContent).toEqual("console.log('Hello, world!');");
|
||||
const secondContent = node.querySelector('[id$="-content-3"] code')
|
||||
.textContent;
|
||||
expect("print('Hello, world!')").toEqual(secondContent);
|
||||
expect(secondContent).toEqual("print('Hello, world!')");
|
||||
const thirdContent = node.querySelector('[id$="-content-4"] code')
|
||||
.textContent;
|
||||
expect(
|
||||
expect(thirdContent).toEqual(
|
||||
'#include <stdio.h>int main() { printf("Hello World!"); return 0;}',
|
||||
).toEqual(thirdContent);
|
||||
);
|
||||
const fourthContent = node.querySelector('[id$="-content-5"] code')
|
||||
.textContent;
|
||||
expect("program HelloWorld;begin WriteLn('Hello, world!');end.").toEqual(
|
||||
fourthContent,
|
||||
expect(fourthContent).toEqual(
|
||||
"program HelloWorld;begin WriteLn('Hello, world!');end.",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue