From 53d4afdae5a47e9335f99c2e45fe0b1521f3b5da Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 5 Dec 2024 20:39:29 +0000 Subject: [PATCH] Enable rule to enforce specifying language for code blocks --- CI/example.markdownlint-cli2.jsonc | 14 ++++++-------- docs/developers/Building_Android.md | 4 ++-- docs/developers/Building_Linux.md | 4 ++-- docs/developers/Building_iOS.md | 9 ++++----- docs/developers/Building_macOS.md | 2 +- docs/developers/CMake.md | 4 ++-- docs/developers/Conan.md | 8 ++++---- docs/developers/Lua_Scripting_System.md | 2 +- docs/developers/Networking.md | 4 ++-- docs/modders/Bonus/Bonus_Range_Types.md | 2 +- docs/modders/Bonus/Bonus_Value_Types.md | 4 ++-- docs/modders/Configurable_Widgets.md | 4 ++-- docs/modders/Mod_File_Format.md | 2 +- docs/modders/Readme.md | 4 ++-- docs/players/Installation_Linux.md | 16 ++++++++-------- docs/players/Installation_iOS.md | 2 +- 16 files changed, 41 insertions(+), 44 deletions(-) diff --git a/CI/example.markdownlint-cli2.jsonc b/CI/example.markdownlint-cli2.jsonc index 13e8155eb..a9cfda2cb 100644 --- a/CI/example.markdownlint-cli2.jsonc +++ b/CI/example.markdownlint-cli2.jsonc @@ -182,14 +182,12 @@ "MD039": true, // MD040/fenced-code-language : Fenced code blocks should have a language specified : https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md040.md - "MD040": false, - // FIXME: enable and consider fixing - //{ - //// List of languages - // "allowed_languages": [ "cpp", "json5", "sh" ], - //// Require language only - // "language_only": true - //}, + "MD040": { + // List of languages + "allowed_languages": [ "cpp", "json", "sh", "text", "nix", "powershell", "lua" ], + // Require language only + "language_only": true + }, // MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md041.md "MD041": { diff --git a/docs/developers/Building_Android.md b/docs/developers/Building_Android.md index 5d1af915e..c2517ba26 100644 --- a/docs/developers/Building_Android.md +++ b/docs/developers/Building_Android.md @@ -22,7 +22,7 @@ The following instructions apply to **v1.2 and later**. For earlier versions the Clone with submodules. Example for command line: -``` +```sh git clone --recurse-submodules https://github.com/vcmi/vcmi.git ``` @@ -42,7 +42,7 @@ Conan must be aware of the NDK location when you execute `conan install`. There' - the easiest is to download NDK from Conan (option 1 in the docs), then all the magic happens automatically. On the step where you need to replace **PROFILE**, choose *android-**X**-ndk* where ***X*** is either `32` or `64`. - to use an already installed NDK, you can simply pass it on the command line to `conan install`: (note that this will work only when consuming the pre-built binaries) -``` +```sh conan install -c tools.android:ndk_path=/path/to/ndk ... ``` diff --git a/docs/developers/Building_Linux.md b/docs/developers/Building_Linux.md index d4cabb57b..7fa79e487 100644 --- a/docs/developers/Building_Linux.md +++ b/docs/developers/Building_Linux.md @@ -70,7 +70,7 @@ And put it into build directory. Then run `nix-shell` before running any build c We recommend the following directory structure: -``` +```text . ├── vcmi -> contains sources and is under git control └── build -> contains build output, makefiles, object files,... @@ -97,7 +97,7 @@ See [CMake](CMake.md) for a list of options ### Trigger build -``` +```sh cmake --build . -j8 ``` diff --git a/docs/developers/Building_iOS.md b/docs/developers/Building_iOS.md index d9e98073b..f95f8f294 100644 --- a/docs/developers/Building_iOS.md +++ b/docs/developers/Building_iOS.md @@ -12,7 +12,7 @@ Clone with submodules. Example for command line: -``` +```sh git clone --recurse-submodules https://github.com/vcmi/vcmi.git ``` @@ -36,9 +36,8 @@ There're a few [CMake presets](https://cmake.org/cmake/help/latest/manual/cmake- Open terminal and `cd` to the directory with source code. Configuration example for device with Conan: -``` -cmake --preset ios-device-conan \ - -D BUNDLE_IDENTIFIER_PREFIX=com.MY-NAME +```sh +cmake --preset ios-device-conan -D BUNDLE_IDENTIFIER_PREFIX=com.MY-NAME ``` By default build directory containing Xcode project will appear at `../build-ios-device-conan`, but you can change it with `-B` option. @@ -61,7 +60,7 @@ You must also install game files, see [Installation on iOS](../players/Installat ### From command line -``` +```sh cmake --build --target vcmiclient -- -quiet ``` diff --git a/docs/developers/Building_macOS.md b/docs/developers/Building_macOS.md index 0f3c40a43..b5a309581 100644 --- a/docs/developers/Building_macOS.md +++ b/docs/developers/Building_macOS.md @@ -15,7 +15,7 @@ Clone with submodules. Example for command line: -``` +```sh git clone --recurse-submodules https://github.com/vcmi/vcmi.git ``` diff --git a/docs/developers/CMake.md b/docs/developers/CMake.md index 4295bef1b..e4adadd48 100644 --- a/docs/developers/CMake.md +++ b/docs/developers/CMake.md @@ -4,12 +4,12 @@ * Enables debug info and disables optimizations * `-D CMAKE_EXPORT_COMPILE_COMMANDS=ON` * Creates `compile_commands.json` for [clangd](https://clangd.llvm.org/) language server. For clangd to find the JSON, create a file named `.clangd` with this content - ``` + ```text CompileFlags: CompilationDatabase: build ``` and place it here: - ``` + ```text . ├── vcmi -> contains sources and is under git control ├── build -> contains build output, makefiles, object files,... diff --git a/docs/developers/Conan.md b/docs/developers/Conan.md index fb3ec206e..fb29795f8 100644 --- a/docs/developers/Conan.md +++ b/docs/developers/Conan.md @@ -126,7 +126,7 @@ In these examples only the minimum required amount of options is passed to `cmak ### Use our prebuilt binaries to build for macOS x86_64 with Xcode -``` +```sh conan install . \ --install-folder=conan-generated \ --no-imports \ @@ -143,7 +143,7 @@ cmake -S . -B build -G Xcode \ If you also want to build the missing binaries from source, use `--build=missing` instead of `--build=never`. -``` +```sh conan install . \ --install-folder=~/my-dir \ --no-imports \ @@ -158,7 +158,7 @@ cmake -S . -B build \ ### Use our prebuilt binaries to build for iOS arm64 device with custom preset -``` +```sh conan install . \ --install-folder=~/my-dir \ --no-imports \ @@ -205,7 +205,7 @@ ubuntu Next steps are identical both in WSL and in real Ubuntu 22.04 -```bash +```sh sudo pip3 install conan sudo apt install cmake build-essential sed -i 's/x86_64-w64-mingw32/i686-w64-mingw32/g' CI/mingw-ubuntu/before-install.sh diff --git a/docs/developers/Lua_Scripting_System.md b/docs/developers/Lua_Scripting_System.md index 41cb0d87a..9968d7206 100644 --- a/docs/developers/Lua_Scripting_System.md +++ b/docs/developers/Lua_Scripting_System.md @@ -65,7 +65,7 @@ TODO **In near future Lua API may change drastically several times. Information #### Low level events API -``` Lua +```lua -- Each event type must be loaded first local PlayerGotTurn = require("events.PlayerGotTurn") diff --git a/docs/developers/Networking.md b/docs/developers/Networking.md index 7d7b1c386..35407d496 100644 --- a/docs/developers/Networking.md +++ b/docs/developers/Networking.md @@ -6,7 +6,7 @@ For implementation details see files located at `lib/network` directory. VCMI uses connection using TCP to communicate with server, even in single-player games. However, even though TCP is stream-based protocol, VCMI uses atomic messages for communication. Each message is a serialized stream of bytes, preceded by 4-byte message size: -``` +```cpp int32_t messageSize; byte messagePayload[messageSize]; ``` @@ -37,7 +37,7 @@ For implementation details see: In case of global lobby, message payload uses plaintext json format - utf-8 encoded string: -``` +```cpp int32_t messageSize; char jsonString[messageSize]; ``` diff --git a/docs/modders/Bonus/Bonus_Range_Types.md b/docs/modders/Bonus/Bonus_Range_Types.md index c1aeef280..c3b5567ef 100644 --- a/docs/modders/Bonus/Bonus_Range_Types.md +++ b/docs/modders/Bonus/Bonus_Range_Types.md @@ -10,7 +10,7 @@ TODO: ONLY_MELEE_FIGHT / ONLY_DISTANCE_FIGHT range types work ONLY with creature For replacing ONLY_ENEMY_ARMY alias, you should use the following parameters of bonus: -``` +```text "propagator": "BATTLE_WIDE", "propagationUpdater" : "BONUS_OWNER_UPDATER", "limiters" : [ "OPPOSITE_SIDE" ] diff --git a/docs/modders/Bonus/Bonus_Value_Types.md b/docs/modders/Bonus/Bonus_Value_Types.md index d9950a122..9b4a6e75b 100644 --- a/docs/modders/Bonus/Bonus_Value_Types.md +++ b/docs/modders/Bonus/Bonus_Value_Types.md @@ -4,7 +4,7 @@ Total value of Bonus is calculated using the following: - For each bonus source type we calculate new source value (for all bonus value types except PERCENT_TO_SOURCE and PERCENT_TO_TARGET_TYPE) using the following: -``` +```text newVal = (val * (100 + PERCENT_TO_SOURCE) / 100)) ``` @@ -12,7 +12,7 @@ newVal = (val * (100 + PERCENT_TO_SOURCE) / 100)) - All bonus value types summarized and then used as subject of the following formula: -``` +```text clamp(((BASE_NUMBER * (100 + PERCENT_TO_BASE) / 100) + ADDITIVE_VALUE) * (100 + PERCENT_TO_ALL) / 100), INDEPENDENT_MAX, INDEPENDENT_MIN) ``` diff --git a/docs/modders/Configurable_Widgets.md b/docs/modders/Configurable_Widgets.md index ec2eccd11..2d968af49 100644 --- a/docs/modders/Configurable_Widgets.md +++ b/docs/modders/Configurable_Widgets.md @@ -22,7 +22,7 @@ In this tutorial we will recreate options tab to support chess timers UI. To start making mod, create following folders structure; -``` +```text extendedLobby/ |- content/ | |- sprites/ @@ -413,7 +413,7 @@ Predefined fonts: Hint text is a pair of strings, one is usually shown in status bar when cursor hovers element, another hint while right button pressed. Each of elements is a [Text](#text) -``` +```json { "hover": "Text", "help": "Text diff --git a/docs/modders/Mod_File_Format.md b/docs/modders/Mod_File_Format.md index a7a647689..aabb3a59f 100644 --- a/docs/modders/Mod_File_Format.md +++ b/docs/modders/Mod_File_Format.md @@ -195,7 +195,7 @@ These are fields that are present only in local mod.json file In addition to field listed above, it is possible to add following block for any language supported by VCMI. If such block is present, Launcher will use this information for displaying translated mod information and game will use provided json files to translate mod to specified language. See [Translations](Translations.md) for more information -``` +```json "" : { "name" : "", "description" : "", diff --git a/docs/modders/Readme.md b/docs/modders/Readme.md index db55fc97d..783060c26 100644 --- a/docs/modders/Readme.md +++ b/docs/modders/Readme.md @@ -8,7 +8,7 @@ All content of your mod should go into **Content** directory, e.g. **Mods/myMod/ Example of how directory structure of your mod may look like: -``` +```text Mods/ myMod/ mod.json @@ -208,7 +208,7 @@ Link to our mod will looks like that: