# Configuration
You can customize the behavior of cargo-sync-rdme by adding the following section to `Cargo.toml`.
```toml
[package.metadata.cargo-sync-rdme]
extra-targets = "./docs/configuration.md"
[package.metadata.cargo-sync-rdme.badge]
style = "for-the-badge"
[package.metadata.cargo-sync-rdme.badge.badges]
maintenance = true
license = true
[package.metadata.cargo-sync-rdme.rustdoc]
html-root-url = "<url>"
```
## Common configuration
You can customize the behavior of cargo-sync-rdme by adding the following section to `Cargo.toml`.
```toml
[package.metadata.cargo-sync-rdme]
extra-targets = "./docs/configuration.md"
```
### `extra-targets` (`package.metadata.cargo-sync-rdme.extra-targets`)
The `extra-targets` option specifies the paths to the files that are also updated when `cargo sync-rdme` is executed.
String or array of strings can be specified.
```toml
[package.metadata.cargo-sync-rdme]
extra-targets = "./docs/configuration.md"
```
```toml
[package.metadata.cargo-sync-rdme]
extra-targets = ["./docs/configuration.md", "./docs/usage.md"]
```
## Badge configuration
You can customize the badges generated by cargo-sync-rdme by adding the following section to `Cargo.toml`:
```toml
[package.metadata.cargo-sync-rdme.badge]
style = "flat-square"
[package.metadata.cargo-sync-rdme.badge.badges]
maintenance = true
license = true
```
Badges are output in the order in which the configuration items are written.
Output README file is as follows:
```markdown
[](https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section)
[](#license)
```
### `style` (`package.metadata.cargo-sync-rdme.badge.style`)
The `style` option specifies the style of the badge.
The following styles are supported:
| `flat` |  |
| `flat-square` |  |
| `for-the-badge` |  |
| `plastic` |  |
| `social` |  |
### Badge configuration items
The following configuration items are available for badges:
#### Maintenance status (`package.metadata.cargo-sync-rdme.badge.{badges,badges-*}.{maintenance,maintenance-*}`)
[](https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section)
A badge indicating the maintenance status of the package.
The badge is generated from the `package.metadata.maintenance.status` field in `Cargo.toml`
(see [the cargo documentation](https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section) for details).
The link target of the badge is set to <https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section>.
Available values:
* `maintenance = true` : Output a maintenance status badge
* `maintenance = false` : Do not output a maintenance status badge
#### License (`package.metadata.cargo-sync-rdme.badge.{badges,badges-*}.{license,license-*}`)

A badge indicating the license of the package.
The badge is generated from the `package.license` field or `package.license-file` field in `Cargo.toml`
(see [the cargo documentation](https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields) for details).
The link target of the badge is determined by the badge configuration.
Available values:
* `license = { link = "<link>" }` : Output a license badge. The link target of the badge is set to `<link>`
* `license = true` : Output a license badge
* If `package.license-file` is specified, the link target of the badge is set to the license file
* If `package.license` is specified, no link is set
* `license = false` : Do not output a license badge
#### crates.io (`package.metadata.cargo-sync-rdme.badge.{badges,badges-*}.{crates-io,crates-io-*}`)
[](https://crates.io/crates/cargo-sync-rdme)
A badge indicating the version of the package on crates.io.
The badge is generated from the `package.name` field in `Cargo.toml`
(see [the cargo documentation](https://doc.rust-lang.org/cargo/reference/manifest.html#the-name-field) for details).
The link target of the badge is set to `https://crates.io/crates/<package name>)`.
Available values:
* `crates-io = true` : Output a crates.io badge
* `crates-io = false` : Do not output a crates.io badge
#### Docs.rs (`package.metadata.cargo-sync-rdme.badge.{badges,badges-*}.{docs-rs,docs-rs-*}`)
[](https://docs.rs/cargo-sync-rdme)
A badge indicating the documentation build status of the package on docs.rs.
The badge is generated from the `package.name` field in `Cargo.toml`
(see [the cargo documentation](https://doc.rust-lang.org/cargo/reference/manifest.html#the-name-field) for details).
The link target of the badge is set to `https://docs.rs/<package name>)`.
Available values:
* `docs-rs = true` : Output a docs.rs badge
* `docs-rs = false` : Do not output a docs.rs badge
#### Rust Version (MSRV) (`package.metadata.cargo-sync-rdme.badge.{badges,badges-*}.{rust-version,rust-version-*}`)
[](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
A badge indicating the minimum supported Rust version (MSRV) of the package.
The badge is generated from the `package.metadata.rust-version` field in `Cargo.toml`
(see [the cargo documentation](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) for details).
The link target of the badge is set to <https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field>.
Available values:
* `rust-version = true` : Output a supported rust version badge
* `rust-version = false` : Do not output a supported rust version badge
#### GitHub Actions (`package.metadata.cargo-sync-rdme.badge.{badges,badges-*}.{github-actions,github-actions-*}`)
[](https://github.com/gifnksm/cargo-sync-rdme/actions/workflows/cd.yml)
[](https://github.com/gifnksm/cargo-sync-rdme/actions/workflows/ci.yml)
[](https://github.com/gifnksm/cargo-sync-rdme/actions/workflows/pages.yml)
[](https://github.com/gifnksm/cargo-sync-rdme/actions/workflows/audit.yml)
[](https://github.com/gifnksm/cargo-sync-rdme/actions/workflows/update-deps.yml)
A badge indicating the status of the GitHub Actions workflow.
The badge is generated from the `package.repository` field in `Cargo.toml`
(see [the cargo documentation](https://doc.rust-lang.org/cargo/reference/manifest.html#the-repository-field) for details).
The link target of the badge is set to `<package.repository>/actions/workflows/<file>`.
`<file>` is the name of the file in the `.github/workflows` directory.
Available values:
* `github-actions = { workflows = [ { file = "<file>", name = "<name>" }, ..] }` :
Output a GitHub Actions status badges.
The link target of the badge is set to `<package.repository>/actions/workflows/<file>`.
`<name>` is used as the badge name.
If `<name>` is not specified, the name of the workflow defined in the `<file>` is used as the badge name.
* `github-actions = { workflows = [ "<file>" ] }` :
Same as `github-actions = { workflows = [ { file = "<file>" } ] }`
* `github-actions = { workflows = "<file>" }` :
Same as `github-actions = { workflows = [ { file = "<file>" } ] }`
* `github-actions = { workflows = [] }` :
Output a GitHub Actions status badge for all workflows in the `.github/workflows` directory.
* `github-actions = true` : Same as `github-actions = { workflows = [] }`
* `github-actions = false` : Do not output a GitHub Actions status badge
#### Codecov (`package.metadata.cargo-sync-rdme.badge.{badges,badges-*}.{codecov,codecov-*}`)
[](https://codecov.io/gh/gifnksm/cargo-sync-rdme)
A badge indicating the coverage of the package.
The badge is generated from the `package.repository` field in `Cargo.toml`
(see [the cargo documentation](https://doc.rust-lang.org/cargo/reference/manifest.html#the-repository-field) for details).
The link target of the badge is set to `https://codecov.io/gh/<repository_path>/`.
Available values:
* `codecov = false` : Do not output a Codecov badge
* `codecov = true` : Output a Codecov badge
* `codecov = {}` : Same as `codecov = true`
* `codecov = { ... }` : Output a Codecov badge with additional options
Available options for `codecov = { ... }`:
* `component = "<component>"` : Add the `component=<component>` query parameter to the badge image URL
* `flag = "<flag>"` : Add the `flag=<flag>` query parameter to the badge image URL
### Multiple badge items with the same kind
If you want to use the same kind of badge multiple times, add the `-*` suffix to the configuration item name.
```toml
[package.metadata.sync-rdme.badge.badges]
github-actions-foo = { workflows = "foo.yml" }
github-actions-bar = { workflows = "bar.yml" }
```
### Badge groups
You can define multiple badge groups and select the badge groups to be output using the `package.metadata.sync-rdme.badge.badges-<group-name>` section.
```toml
[package.metadata.sync-rdme.badge.badges-foo]
# foo group definition
license = true
maintenance = true
[package.metadata.sync-rdme.badge.badges-bar]
# bar group definition
crates-io = true
docs-rs = true
```
You can embed the badge groups in the `README.md` using the following syntax:
```markdown
Before sync:
After sync:
badges...
```
## Rustdoc configuration
You can customize the crate documentation generated by cargo-sync-rdme by adding the following section to `Cargo.toml`:
```toml
[package.metadata.cargo-sync-rdme.rustdoc]
html-root-url = "<url>"
[package.metadata.cargo-sync-rdme.rustdoc.mapping]
SomeType = "./docs/some-type.md"
```
The following configuration items are available for rustdoc:
* `html-root-url` : Set the root URL of the documentation for the packages in the workspace.
The default value is `https://docs.rs/<package name>/<package version>`.
If you host the documentation of main/master branch on GitHub Pages, you can set the value to `https://<user>.github.io/<repository>/`.
* `mapping`: Allows you to provide an override for a path to a URL.