diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cc81ea04be2..cfdf24a4bb4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,6 +11,15 @@ repos: entry: bash -c 'if [ ! -f "$(dirname "$dir")"/frontend/src/locales/ar.json ]; then just frontend/run i18n; fi' language: system pass_filenames: false + - id: fix-console-code-block + name: Ensure "bash" code block is used over "console" + files: ^documentation/.*\.md$ + # Check that we are not using the ```console block in our documentation + # -R recursively checks files + # -l suppresses normal input and only lists files with errors + # Print an error message if any files are found + entry: sed -i -e 's/```console/```bash/g' + language: system - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 diff --git a/documentation/api/guides/https.md b/documentation/api/guides/https.md index 13d4d3cd085..e23949fe393 100644 --- a/documentation/api/guides/https.md +++ b/documentation/api/guides/https.md @@ -18,8 +18,8 @@ Additionally, you will need to install 1. Create certificates for NGINX to use. - ```console - $ just docker/nginx/cert + ```bash + just docker/nginx/cert ``` This will create a certificate file `openversse.crt` and a key file @@ -28,8 +28,8 @@ Additionally, you will need to install 2. Bring the ingestion server and API up, along with all their dependent services. - ```console - $ just api/up + ```bash + just api/up ``` The `api/up` recipe orchestrates the following services: `cache`, `db`, @@ -40,8 +40,8 @@ Additionally, you will need to install 3. Make an API call over HTTPS. - ```console - $ just api/stats images https://localhost:50243 + ```bash + just api/stats images https://localhost:50243 just _curl-get "images/stats/" https://localhost:50243 curl "https://localhost:50243/v1/images/stats/" [{"source_name":"flickr","display_name":"Flickr","source_url":"https://www.flickr.com","logo_url":null,"media_count":2500},{"source_name":"stocksnap","display_name":"StockSnap","source_url":"https://stocksnap.io","logo_url":null,"media_count":2500}]% diff --git a/documentation/api/guides/quickstart.md b/documentation/api/guides/quickstart.md index 1efaf7de156..dbab0768ed5 100644 --- a/documentation/api/guides/quickstart.md +++ b/documentation/api/guides/quickstart.md @@ -17,25 +17,25 @@ you need to run this. 2. Clone the repository to your computer. Then switch to the cloned directory. If you're planning to contribute, fork the repo and clone your fork instead. - ```console - $ git clone https://github.com/WordPress/openverse.git # or your fork - $ cd openverse/ + ```bash + git clone https://github.com/WordPress/openverse.git # or your fork + cd openverse/ ``` If you followed the general setup guide and installed [GitHub CLI](/general/general_setup.md#github-cli), you can clone more simply using the `gh` command. - ```console - $ gh repo clone WordPress/openverse # or your fork - $ cd openverse/ + ```bash + gh repo clone WordPress/openverse # or your fork + cd openverse/ ``` 3. Bring the ingestion server and API up, along with all their dependent services. - ```console - $ just api/up + ```bash + just api/up ``` The `api/up` recipe orchestrates the following services: `cache`, `db`, @@ -49,24 +49,24 @@ you need to run this. 4. Load the sample data. This step can take a few minutes to complete. - ```console - $ just api/init + ```bash + just api/init ``` ````{admonition} Troubleshooting If this step fails, cleaning up and restarting usually fixes it. - ```console - $ just down -v - $ just api/init + ```bash + just down -v + just api/init ``` ```` 5. With the data loaded, the API can now return JSON responses to your HTTP requests. - ```console - $ just api/stats + ```bash + just api/stats just _curl-get "images/stats/" http://localhost:50280 curl "http://localhost:50280/v1/images/stats/" [{"source_name":"flickr","display_name":"Flickr","source_url":"https://www.flickr.com","logo_url":null,"media_count":2500},{"source_name":"stocksnap","display_name":"StockSnap","source_url":"https://stocksnap.io","logo_url":null,"media_count":2500}]% @@ -77,8 +77,8 @@ you need to run this. JSON data. If you have `jq` installed, you can pipe the response to it and transform it. - ```console - $ just api/stats | jq '.[0]' + ```bash + just api/stats | jq '.[0]' { "source_name": "flickr", "display_name": "Flickr", @@ -87,7 +87,7 @@ you need to run this. "media_count": 2500 } - $ just api/stats 'audio' | jq '[.[] | .source_name]' + just api/stats 'audio' | jq '[.[] | .source_name]' [ "freesound", "jamendo", diff --git a/documentation/api/guides/test.md b/documentation/api/guides/test.md index 1de1e46831e..b91480f7c85 100644 --- a/documentation/api/guides/test.md +++ b/documentation/api/guides/test.md @@ -9,8 +9,8 @@ Once you've made some changes to the codebase, it is important to run tests. 2. Run the tests. - ```console - $ just api/test + ```bash + just api/test ``` ```{note} diff --git a/documentation/automations/guides/quickstart.md b/documentation/automations/guides/quickstart.md index 59d287910c9..22a456ea6fe 100644 --- a/documentation/automations/guides/quickstart.md +++ b/documentation/automations/guides/quickstart.md @@ -26,8 +26,8 @@ If you wish to install only dependencies for automations, run the following: Run Python automation scripts using the `automations/python/run` just recipe. Ex.: -``` -$ just automations/python/run print_labels.py +```bash +just automations/python/run print_labels.py ``` The recipe is an alias for running `pipenv run