From e3cb91b0c776d6f4a83fc932ea6e35966e2e94e8 Mon Sep 17 00:00:00 2001 From: gospodima Date: Mon, 15 Sep 2025 20:27:00 +0200 Subject: [PATCH 1/7] feat: add --version support --- src/config.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index 7a97960..e2acdfc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -3,11 +3,9 @@ use std::path::PathBuf; use clap::Parser; use regex::Regex; -// TODO: add dir exclusion similar to files - /// CLI configuration for mdrefcheck #[derive(Parser, Debug)] -#[command(name = "mdrefcheck", about = "Check markdown references.")] +#[command(name = "mdrefcheck", about = "Check markdown references.", version)] pub struct CliConfig { /// Paths to check #[arg(required = true, value_name = "PATH")] From 64ff05e2481cbd552ac4bc54c3b9e652e22c0afb Mon Sep 17 00:00:00 2001 From: gospodima Date: Mon, 15 Sep 2025 20:35:55 +0200 Subject: [PATCH 2/7] docs: extend installation instructions, fix changelogs --- CHANGELOG.md | 4 ++-- README.md | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20a4083..6b7e7d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # Changelog -## [0.1.4] - 2025-09-14 +## [0.1.5] - 2025-09-14 ### CI -- Move cargo pyblish before artifacts staff +- Move cargo publish before artifacts staff ## [0.1.3] - 2025-09-14 diff --git a/README.md b/README.md index bcf4f68..2e4aea5 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ **mdrefcheck** is a CLI tool to validate references and links in Markdown files (CommonMark spec). It helps ensure that your documentation is free from broken links, missing images, and invalid section anchors. ---- - ## Features - Validate local file paths in image and section references @@ -12,12 +10,27 @@ It helps ensure that your documentation is free from broken links, missing image - Identify broken reference-style links - Email validation ---- - ## Installation -From PyPI: +## PyPI + +mdrefcheck can be installed with ```bash pip install mdrefcheck ``` + +It also can be used as a tool in an isolated environment, e.g., with `uvx`: + +```bash +uvx mdrefcheck . +``` + +## Cargo + +mdrefcheck is also published on [crates.io](https://crates.io/) and can be installed +with cargo: + +```bash +cargo install mdrefcheck +``` \ No newline at end of file From 84a2ca3da61f9830f727845fd3258671e92e974c Mon Sep 17 00:00:00 2001 From: gospodima Date: Mon, 15 Sep 2025 20:51:59 +0200 Subject: [PATCH 3/7] chore: add pre-commit hook --- .pre-commit-hooks.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .pre-commit-hooks.yaml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..0943ab6 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,8 @@ +- id: mdrefcheck + name: mdrefcheck + description: Validate references in Markdown files + entry: mdrefcheck + language: python + types: [markdown] + require_serial: true + args: [] \ No newline at end of file From 45f40672dd3271c6aced47b9d31d44de42ca2094 Mon Sep 17 00:00:00 2001 From: gospodima Date: Mon, 15 Sep 2025 21:30:51 +0200 Subject: [PATCH 4/7] chore: remove require_serial --- .pre-commit-hooks.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 0943ab6..8c17e83 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -4,5 +4,4 @@ entry: mdrefcheck language: python types: [markdown] - require_serial: true args: [] \ No newline at end of file From a4c0d7ca5c3f493a55b9bb37c1ae78b15bc9ce53 Mon Sep 17 00:00:00 2001 From: gospodima Date: Tue, 16 Sep 2025 20:34:50 +0200 Subject: [PATCH 5/7] docs: add pre-commit integration section and minor README improvements --- README.md | 34 ++++++++++++++++++++++++---------- release.toml | 3 ++- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2e4aea5..bf8d9c6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # mdrefcheck -**mdrefcheck** is a CLI tool to validate references and links in Markdown files (CommonMark spec). -It helps ensure that your documentation is free from broken links, missing images, and invalid section anchors. +A CLI tool to validate references and links in Markdown files (CommonMark spec). +It helps to ensure that your documentation is free from broken section links, missing images or files. ## Features @@ -12,9 +12,18 @@ It helps ensure that your documentation is free from broken links, missing image ## Installation -## PyPI +### Cargo -mdrefcheck can be installed with +`mdrefcheck` is also published on [crates.io](https://crates.io/) and can be installed +with cargo: + +```bash +cargo install mdrefcheck +``` + +### PyPI + +`mdrefcheck` can be installed with ```bash pip install mdrefcheck @@ -26,11 +35,16 @@ It also can be used as a tool in an isolated environment, e.g., with `uvx`: uvx mdrefcheck . ``` -## Cargo +### Pre-commit integration -mdrefcheck is also published on [crates.io](https://crates.io/) and can be installed -with cargo: +You can use `mdrefcheck` as a pre-commit hook. -```bash -cargo install mdrefcheck -``` \ No newline at end of file +Add this to your `.pre-commit-config.yaml`: + +```yaml +repos: + - repo: https://github.com/gospodima/mdrefcheck + rev: v0.1.5 + hooks: + - id: mdrefcheck +``` diff --git a/release.toml b/release.toml index 4bbdbef..a362c25 100644 --- a/release.toml +++ b/release.toml @@ -1,4 +1,5 @@ pre-release-replacements = [ - {file="pyproject.toml", search='version = "[a-z0-9\\.-]+"', replace='version = "{{version}}"'} + {file="pyproject.toml", search='version = "[a-z0-9\\.-]+"', replace='version = "{{version}}"'}, + {file="README.md", search='rev: v[a-z0-9\\.-]+', replace='rev: v{{version}}'} ] pre-release-commit-message = "chore(release): prepare for {{version}}" From d6a3dce9ffe76a1a3dad58f09aa21b5acf465672 Mon Sep 17 00:00:00 2001 From: gospodima Date: Tue, 16 Sep 2025 20:37:36 +0200 Subject: [PATCH 6/7] chore: pre-commit tests --- src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.rs b/src/main.rs index 006b6a6..1a22425 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,8 @@ use std::{fs, process}; fn main() { let config = CliConfig::parse(); + println!("{:?}", config); + let exclude_paths = create_file_set(&config.exclude); let files = gather_markdown_files(&config.paths, &exclude_paths); From 63f197f6e663286f38c75e646098add3608496ec Mon Sep 17 00:00:00 2001 From: gospodima Date: Tue, 16 Sep 2025 20:52:37 +0200 Subject: [PATCH 7/7] Revert "chore: pre-commit tests" This reverts commit d6a3dce9ffe76a1a3dad58f09aa21b5acf465672. --- src/main.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1a22425..006b6a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,8 +9,6 @@ use std::{fs, process}; fn main() { let config = CliConfig::parse(); - println!("{:?}", config); - let exclude_paths = create_file_set(&config.exclude); let files = gather_markdown_files(&config.paths, &exclude_paths);