Function version_sync::check_markdown_deps [] [src]

pub fn check_markdown_deps(
    path: &str,
    pkg_name: &str,
    pkg_version: &str
) -> Result<(), String>

Check dependencies in Markdown code blocks.

This function finds all TOML code blocks in path and looks for dependencies on pkg_name in those blocks. A code block fails the check if it has a dependency on pkg_name that doesn't match pkg_version, or if it has no dependency on pkg_name at all.

Examples

Consider a package named foo with version 1.2.3. The following TOML block will pass the test:

```toml
[dependencies]
foo = "1.2.3"
```

Both dependencies and dev-dependencies are examined. If you want to skip a block, add no_sync to the language line:

```toml,no_sync
[dependencies]
foo = "1.2.3"
```

Code blocks also fail the check if they cannot be parsed as TOML.

Errors

If any block fails the check, an Err is returned with a succinct error message. Status information has then already been printed on stdout.