diff --git a/contribute/autogenerated-documentation-from-source.md b/contribute/autogenerated-documentation-from-source.md index 846f10734b2..600a025cc4b 100644 --- a/contribute/autogenerated-documentation-from-source.md +++ b/contribute/autogenerated-documentation-from-source.md @@ -61,18 +61,16 @@ TO DO ## Functions Documentation for functions is autogenerated from the documentation in system tables (`system.functions`) which is -registered along with the function registration in the C++ code. +registered along with the function registration in the C++ code. ([Example](https://github.com/ClickHouse/ClickHouse/blob/a0216c8120f00479f50237e41c897c2bf244e1ef/src/Functions/FunctionChar.cpp#L116-L158)) -To add a new page: -- add SQL to generate the markdown from system tables -- update `autogenerate-settings.sh` in the section which specifies which markdown file contents to - copy to which file in between the `` and `` +This [script](https://github.com/ClickHouse/clickhouse-docs/blob/main/scripts/settings/autogenerate-settings.sh) is used to generate +the markdown docs for functions. -The following pages are autogenerated from the source code for functions: -- [Arithmetic](/sql-reference/functions/arithmetic-functions) ([SQL](../scripts/settings/arithmetic-functions.sql)) -- [Arrays](/sql-reference/functions/array-functions) ([SQL](../scripts/settings/array-functions.sql)) -- [Bit](/sql-reference/functions/bit-functions) ([SQL](../scripts/settings/bit-functions.sql)) -- [Bitmap](/sql-reference/functions/bitmap-functions) ([SQL](../scripts/settings/bitmap-functions.sql)) -- [Comparison](/sql-reference/functions/comparison-functions) ([SQL](../scripts/settings/comparison-functions.sql)) -- [Conditional](/sql-reference/functions/conditional-functions) ([SQL](../scripts/settings/conditional-functions.sql)) +Adding a new page can be done by: +1. Adding the function [category](https://github.com/ClickHouse/ClickHouse/blob/85700c135ccad89d3651a7a92ca63bb989743ba6/src/Common/FunctionDocumentation.cpp#L222-L273) to the [list of function categories to generate](https://github.com/ClickHouse/clickhouse-docs/blob/c31d64bc5d71c6c3afc5b520dbb73386e303447b/scripts/settings/autogenerate-settings.sh#L253-L278). +2. The docs are automatically generated for the categories defined above by [this SQL code](https://github.com/ClickHouse/clickhouse-docs/blob/main/scripts/settings/generate-functions.sql). It produces a temporary markdown file with convention: `category-functions.md`. If the category name contains spaces, e.g. "String Splitting" then the temporary file will be `string_splitting-functions.md`. +3. Register the temporary file name [here](https://github.com/ClickHouse/clickhouse-docs/blob/c31d64bc5d71c6c3afc5b520dbb73386e303447b/scripts/settings/autogenerate-settings.sh#L372) +4. Register the destination file you want to insert the markdown into [here](https://github.com/ClickHouse/clickhouse-docs/blob/c31d64bc5d71c6c3afc5b520dbb73386e303447b/scripts/settings/autogenerate-settings.sh#L399) + +The script takes the content of the temporary markdown file and inserts it into the destination file between tags `` and ``. If those tags do not exist you will get a warning.