diff --git a/README.md b/README.md index d8df7dbaa..417c9bd44 100644 --- a/README.md +++ b/README.md @@ -1627,10 +1627,8 @@ The library itself consists of a single header file licensed under the MIT licen - [**libFuzzer**](https://llvm.org/docs/LibFuzzer.html) to implement fuzz testing for OSS-Fuzz - [**OSS-Fuzz**](https://github.com/google/oss-fuzz) for continuous fuzz testing of the library ([project repository](https://github.com/google/oss-fuzz/tree/master/projects/json)) - [**Probot**](https://probot.github.io) for automating maintainer tasks such as closing stale issues, requesting missing information, or detecting toxic comments. -- [**send_to_wandbox**](https://github.com/nlohmann/json/blob/develop/doc/scripts/send_to_wandbox.py) to send code examples to [Wandbox](https://wandbox.org) - [**Travis**](https://travis-ci.org) for [continuous integration](https://travis-ci.org/nlohmann/json) on Linux and macOS - [**Valgrind**](https://valgrind.org) to check for correct memory management -- [**Wandbox**](https://wandbox.org) for [online examples](https://wandbox.org/permlink/1mp10JbaANo6FUc7) ## Projects using JSON for Modern C++ diff --git a/doc/mkdocs/docs/api/basic_json/is_number.md b/doc/mkdocs/docs/api/basic_json/is_number.md index a73859950..9807911bc 100644 --- a/doc/mkdocs/docs/api/basic_json/is_number.md +++ b/doc/mkdocs/docs/api/basic_json/is_number.md @@ -44,7 +44,7 @@ constexpr bool is_number() const noexcept --8<-- "examples/is_number.output" ``` -# See also +## See also - [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number - [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number diff --git a/doc/mkdocs/docs/api/basic_json/is_number_float.md b/doc/mkdocs/docs/api/basic_json/is_number_float.md index 37bf0fbb9..68d0cfb01 100644 --- a/doc/mkdocs/docs/api/basic_json/is_number_float.md +++ b/doc/mkdocs/docs/api/basic_json/is_number_float.md @@ -35,7 +35,7 @@ Constant. --8<-- "examples/is_number_float.output" ``` -# See also +## See also - [is_number()](is_number.md) check if value is a number - [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number diff --git a/doc/mkdocs/docs/api/basic_json/is_number_integer.md b/doc/mkdocs/docs/api/basic_json/is_number_integer.md index 2e09bc47e..8ca214aed 100644 --- a/doc/mkdocs/docs/api/basic_json/is_number_integer.md +++ b/doc/mkdocs/docs/api/basic_json/is_number_integer.md @@ -35,7 +35,7 @@ Constant. --8<-- "examples/is_number_integer.output" ``` -# See also +## See also - [is_number()](is_number.md) check if value is a number - [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number diff --git a/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md b/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md index 84063d238..2ac98a5f0 100644 --- a/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md +++ b/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md @@ -35,7 +35,7 @@ Constant. --8<-- "examples/is_number_unsigned.output" ``` -# See also +## See also - [is_number()](is_number.md) check if value is a number - [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number diff --git a/doc/mkdocs/docs/api/basic_json/is_primitive.md b/doc/mkdocs/docs/api/basic_json/is_primitive.md index 1810f2b06..cf6cbbd4c 100644 --- a/doc/mkdocs/docs/api/basic_json/is_primitive.md +++ b/doc/mkdocs/docs/api/basic_json/is_primitive.md @@ -54,7 +54,7 @@ This library extends primitive types to binary types, because binary types are --8<-- "examples/is_primitive.output" ``` -# See also +## See also - [is_structured()](is_structured.md) returns whether JSON value is structured - [is_null()](is_null.md) returns whether JSON value is `null` diff --git a/doc/mkdocs/docs/api/basic_json/is_structured.md b/doc/mkdocs/docs/api/basic_json/is_structured.md index b4694163d..f8fe4dcba 100644 --- a/doc/mkdocs/docs/api/basic_json/is_structured.md +++ b/doc/mkdocs/docs/api/basic_json/is_structured.md @@ -52,7 +52,7 @@ Note that though strings are containers in C++, they are treated as primitive va --8<-- "examples/is_structured.output" ``` -# See also +## See also - [is_primitive()](is_primitive.md) returns whether JSON value is primitive - [is_array()](is_array.md) returns whether value is an array diff --git a/doc/mkdocs/docs/api/basic_json/parser_callback_t.md b/doc/mkdocs/docs/api/basic_json/parser_callback_t.md index 6997cbf79..f5400ed22 100644 --- a/doc/mkdocs/docs/api/basic_json/parser_callback_t.md +++ b/doc/mkdocs/docs/api/basic_json/parser_callback_t.md @@ -51,7 +51,7 @@ called: Whether the JSON value which called the function during parsing should be kept (`#!cpp true`) or not (`#!cpp false`). In the latter case, it is either skipped completely or replaced by an empty discarded object. -# Example +## Examples ??? example diff --git a/doc/mkdocs/scripts/check_structure.py b/doc/mkdocs/scripts/check_structure.py index ee472567e..8f0379209 100644 --- a/doc/mkdocs/scripts/check_structure.py +++ b/doc/mkdocs/scripts/check_structure.py @@ -33,16 +33,26 @@ def check_structure(): 'Version history' ] - for file in sorted(glob.glob('api/**/*.md', recursive=True)): + files = sorted(glob.glob('api/**/*.md', recursive=True)) + for file in files: with open(file) as file_content: header_idx = -1 existing_headers = [] in_initial_code_example = False previous_line = None + h1sections = 0 for lineno, line in enumerate(file_content.readlines()): line = line.strip() + if line.startswith('# '): + h1sections += 1 + + # there should only be one top-level title + if h1sections > 1: + print(f'{file}:{lineno+1}: Error: unexpected top-level title "{line}"!') + h1sections = 1 + # Overview pages should have a better title if line == '# Overview': print(f'{file}:{lineno+1}: Error: overview pages should have a better title!') @@ -85,6 +95,7 @@ def check_structure(): if required_header not in existing_headers: print(f'{file}:{lineno+1}: Error: required header "{required_header}" was not found!') + print(f'\nchecked {len(files)} files') if __name__ == '__main__': check_structure()