βAdd
Arguments: [category] [badgeName] [filePath]
This command allows you to add a badge to a file.
For example, if you want to add the Discord badge to your README.md
file, run this command in the same directory as that file:
mdb add social discord README.md
In the file, your badge will appear on the next available line. You can also change the place of it manually, if you'd like.

Adding badges to subdirectories
If the file you're trying to add the badge to is in a subdirectory (or a different location), you will have to specify the path to the subdirectory or location from where you are running the command.
For this example, we'll use a subdirectory.
If you had this project structure:
example-project
βββ src
β βββ index.js
βββ scripts
β βββ README.md << # this is the file in the subdirectory 'scripts'
β βββ update.js
β βββ api.js
βββ package.json
βββ # other files...
then in the [filePath]
argument, you would need to specify the subdirectory.
For the purpose of this explanation, let's say you were currently at example-project
within your terminal. If you wanted to add a badge to the README file in this tree, then in the [filePath]
argument you'll need to type scripts/README.md
to add the badge to that file.
Additional Options
--html
--html
Function: Adds the HTML version of a badge to a file.
You can also add the HTML version of the badge you specify to a file. For example, if you wanted to add the Discord badge to your index.html
file, you can run:
mdb add social discord index.html --html
This will add the following on a new line in the file:
<img src="https://img.shields.io/badge/Discord-%235865F2.svg?&logo=discord&logoColor=white" alt="Discord">
Last updated
Was this helpful?