Skip to content

Commit 6d58818

Browse files
authored
Merge pull request #3523 from ClickHouse/Blargian-patch-2
Update style-guide
2 parents e525129 + 2932bb5 commit 6d58818

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

contribute/style-guide.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export function Anchor(props) {
206206
```
207207
- Replace `<span id="some-id"></span>` with `Anchor id="some-id"/>`
208208

209-
### Dangling pages
209+
### Floating pages
210210

211211
In order to prevent pages from becoming 'floating' or 'orphaned' it is
212212
necessary that you add a newly created page to `sidebars.js`. We have a [custom
@@ -215,3 +215,28 @@ docusaurus plugin](plugins/checkFloatingPages.js) to catch dangling pages.
215215
If there is some specific reason that you need to bypass this check, you can
216216
add an exception to `floating-pages-exceptions.txt` in the plugins directory.
217217

218+
When adding a new page from the ClickHouse/ClickHouse repo this check will fail
219+
unless the file is in a folder which [`sidebars.js`](https://github.com/ClickHouse/clickhouse-docs/blob/main/sidebars.js)
220+
uses with `type: autogenerated` to generate the navigation items from the markdown
221+
files in the folder.
222+
223+
If you've added a new page on ClickHouse/ClickHouse and this check is failing.
224+
225+
For example:
226+
227+
```text
228+
✅ All markdown files passed frontmatter validation.
229+
Loaded 3 exceptions from /opt/clickhouse-docs/plugins/floating-pages-exceptions.txt
230+
Skipping excepted page: index
231+
Skipping excepted page: integrations/language-clients/java/client-v1
232+
Skipping excepted page: integrations/language-clients/java/jdbc-v1
233+
�[31m1 floating pages found:�[0m
234+
- /opt/clickhouse-docs/docs/operations/query-condition-cache.md
235+
```
236+
237+
You will need to open a PR on docs repo to add this page to [`floating-pages-exceptions.txt`](https://github.com/ClickHouse/clickhouse-docs/blob/main/plugins/floating-pages-exceptions.txt). Once it is merged
238+
you can then rerun the docs check on the ClickHouse/ClickHouse repo which
239+
should pass. Finally open another PR on the docs repo again to remove the
240+
file from the exception list and add it to `sidebars.js` in the appropriate
241+
sidebar.
242+

plugins/checkFloatingPages.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ async function checkFloatingPages(context, options = {}) {
9494
if (options && options.failBuild) {
9595
console.error('\x1b[31m%s\x1b[0m', `${floatingPages.length} floating pages found:`);
9696
floatingPages.forEach(page => console.error(` - ${page}`));
97-
throw new Error('🚨 Floating pages found. See above for details.');
97+
throw new Error('Error: Found "floating" pages without sidebars. For further details see: https://github.com/ClickHouse/clickhouse-docs/blob/main/contribute/style-guide.md/');
9898
} else {
99-
console.log('⚠️', 'Found floating pages:');
99+
console.log('Warning:', 'Found floating pages:');
100100
floatingPages.forEach(page => console.log(` - ${page}`));
101101
}
102102
} else {
103-
console.log('', 'No floating pages found.');
103+
console.log('Passed:', 'No floating pages found.');
104104
}
105105
}
106106
}

plugins/frontmatter-validation/frontmatterValidatorPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function frontmatterValidatorPlugin(context, options) {
4444
console.log('See frontmatter-validation-errors.log (when running locally)')
4545

4646
// Fail the build by throwing an error
47-
throw new Error('🚨Frontmatter validation failed. See frontmatter-validation-errors.log for details.');
47+
throw new Error('🚨Frontmatter validation failed. For more details see https://github.com/ClickHouse/clickhouse-docs/blob/main/contribute/style-guide.md');
4848
} else {
4949
console.log(`⚠️ Warning: Found ${filesWithIssues.length} files containing problems with frontmatter`)
5050
}

0 commit comments

Comments
 (0)