ClickHouse/docs/tools
2022-07-18 11:20:53 -04:00
..
.gitignore Update gitignore 2021-03-14 14:53:27 +03:00
build.py Fix publishing of content.clickhouse.com 2022-05-23 11:50:02 +02:00
deploy-to-test.sh Fix shellcheck issues in docs/tools 2022-05-24 11:14:17 +02:00
easy_edit.sh Build Japanese docs (#7938) 2019-12-02 12:21:34 +03:00
make_links.sh Remove unsupported languages #20972 2021-04-01 02:35:41 +03:00
mdx_clickhouse.py Remove minify 2022-04-30 16:37:04 +02:00
README.md switch from mkdocs to Docusaurus 2022-07-18 11:20:53 -04:00
redirects.py Fix publishing of content.clickhouse.com 2022-05-23 11:50:02 +02:00
release.sh Fix shellcheck issues in docs/tools 2022-05-24 11:14:17 +02:00
requirements.txt Fix trash 2022-05-24 22:14:13 +02:00
util.py Fix publishing of content.clickhouse.com 2022-05-23 11:50:02 +02:00
website.py Replace HTML 2022-07-11 23:05:36 +02:00

Generating ClickHouse documentation

ClickHouse documentation is built using Docusaurus.

Check the look of your documentation changes

There are a few options that are all useful depending on how large or complex your edits are.

Use the GitHub web interface to edit

Every page in the docs has an Edit this page link that opens the page in the GitHub editor. GitHub has Markdown support with a preview feature. The details of GitHub Markdown and the documentation Markdown are a bit different but generally this is close enough, and the person merging your PR will build the docs and check them.

Install a Markdown editor or plugin for your IDE

Usually, these plugins provide a preview of how the markdown will render, and they catch basic errors like unclosed tags very early.

Build the docs locally

You can build the docs locally. It takes a few minutes to set up, but once you have done it the first time, the process is very simple.

Clone the repos

The documentation is in two repos, clone both of them:

Install Node.js

The documentation is built with Docusaurus, which requires Node.js. We recommend version 16. Install Node.js.

Copy files into place

Docusaurus expects all of the markdown files to be located in the directory tree clickhouse-docs/docs/. This is not the way our repos are set up, so some copying of files is needed to build the docs:

# from the parent directory of both the ClickHouse/ClickHouse and ClickHouse-clickhouse-docs repos:
cp -r ClickHouse/docs/en/development     clickhouse-docs/docs/en/
cp -r ClickHouse/docs/en/engines         clickhouse-docs/docs/en/
cp -r ClickHouse/docs/en/getting-started clickhouse-docs/docs/en/
cp -r ClickHouse/docs/en/interfaces      clickhouse-docs/docs/en/
cp -r ClickHouse/docs/en/operations      clickhouse-docs/docs/en/
cp -r ClickHouse/docs/en/sql-reference   clickhouse-docs/docs/en/

cp -r ClickHouse/docs/ru/*               clickhouse-docs/docs/ru/
cp -r ClickHouse/docs/zh                 clickhouse-docs/docs/

Setup Docusaurus

There are two commands that you may need to use with Docusaurus:

  • yarn install
  • yarn start

Install Docusaurus and its dependencies:

cd clickhouse-docs
yarn install

Start a development Docusaurus environment

This command will start Docusaurus in development mode, which means that as you edit source (for example, .md files) files the changes will be rendered into HTML files and served by the Docusaurus development server.

yarn start

Make your changes to the markdown files

Edit your files. Remember that if you are editing files in the ClickHouse/ClickHouse repo then you should edit them in that repo and then copy the edited file into the ClickHouse/clickhouse-docs/ directory structure so that they are updated in your develoment environment.

yarn start probably opened a browser for you when you ran it; if not, open a browser to http://localhost:3000/docs/en/intro and navigate to the documentation that you are changing. If you have already made the changes, you can verify them here; if not, make them, and you will see the page update as you save the changes.

How to change code highlighting?

Code highlighting is based on the language chosen for your code blocks. Specify the language when you start the code block:

```sql
SELECT firstname from imdb.actors;
```
SELECT firstname from imdb.actors;

If you need a language supported then open an issue in ClickHouse-docs.

How to subscribe on documentation changes?

At the moment theres no easy way to do just that, but you can consider:

  • To hit the “Watch” button on top of GitHub web interface to know as early as possible, even during pull request. Alternative to this is #github-activity channel of public ClickHouse Slack.
  • Some search engines allow to subscribe on specific website changes via email and you can opt-in for that for https://clickhouse.com.