mdrefcheck 0.1.5__tar.gz → 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mdrefcheck might be problematic. Click here for more details.
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/.github/workflows/ci.yml +1 -1
- mdrefcheck-0.1.7/.pre-commit-hooks.yaml +7 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/Cargo.lock +8 -1
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/Cargo.toml +2 -1
- mdrefcheck-0.1.7/PKG-INFO +70 -0
- mdrefcheck-0.1.7/README.md +48 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/pyproject.toml +1 -1
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/release.toml +2 -1
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/checks/email.rs +1 -2
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/config.rs +1 -3
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/diagnostics.rs +15 -3
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/utils.rs +9 -4
- mdrefcheck-0.1.5/CHANGELOG.md +0 -54
- mdrefcheck-0.1.5/PKG-INFO +0 -45
- mdrefcheck-0.1.5/README.md +0 -23
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/.gitignore +0 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/LICENSE +0 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/rustfmt.toml +0 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/checks/image.rs +0 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/checks/section.rs +0 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/checks.rs +0 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/lib.rs +0 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/main.rs +0 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/parser.rs +0 -0
- {mdrefcheck-0.1.5 → mdrefcheck-0.1.7}/src/scanner.rs +0 -0
|
@@ -122,6 +122,12 @@ dependencies = [
|
|
|
122
122
|
"windows-sys 0.59.0",
|
|
123
123
|
]
|
|
124
124
|
|
|
125
|
+
[[package]]
|
|
126
|
+
name = "dunce"
|
|
127
|
+
version = "1.0.5"
|
|
128
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
129
|
+
checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
|
|
130
|
+
|
|
125
131
|
[[package]]
|
|
126
132
|
name = "getopts"
|
|
127
133
|
version = "0.2.23"
|
|
@@ -145,10 +151,11 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
|
|
145
151
|
|
|
146
152
|
[[package]]
|
|
147
153
|
name = "mdrefcheck"
|
|
148
|
-
version = "0.1.
|
|
154
|
+
version = "0.1.7"
|
|
149
155
|
dependencies = [
|
|
150
156
|
"clap",
|
|
151
157
|
"colored",
|
|
158
|
+
"dunce",
|
|
152
159
|
"pathdiff",
|
|
153
160
|
"pulldown-cmark",
|
|
154
161
|
"regex",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "mdrefcheck"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.7"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
description = "A CLI tool to validate references in markdown files."
|
|
@@ -14,6 +14,7 @@ categories = ["command-line-utilities", "development-tools"]
|
|
|
14
14
|
[dependencies]
|
|
15
15
|
clap = { version = "4.5.47", features = ["derive"] }
|
|
16
16
|
colored = "3.0.0"
|
|
17
|
+
dunce = "1.0.5"
|
|
17
18
|
pathdiff = "0.2.3"
|
|
18
19
|
pulldown-cmark = "0.13.0"
|
|
19
20
|
regex = "1.11.2"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mdrefcheck
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Programming Language :: Rust
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Topic :: Documentation
|
|
11
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
12
|
+
Classifier: Topic :: Utilities
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Summary: A CLI tool to validate references in markdown files.
|
|
15
|
+
Home-Page: https://github.com/gospodima/mdrefcheck
|
|
16
|
+
Author-email: gospodima <dimasc28@gmail.com>
|
|
17
|
+
License-Expression: MIT
|
|
18
|
+
Requires-Python: >=3.7
|
|
19
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
20
|
+
Project-URL: Repository, https://github.com/gospodima/mdrefcheck
|
|
21
|
+
|
|
22
|
+
# mdrefcheck
|
|
23
|
+
|
|
24
|
+
[](https://pypi.org/project/mdrefcheck/)
|
|
25
|
+
[](https://crates.io/crates/mdrefcheck)
|
|
26
|
+
[](https://github.com/gospodima/mdrefcheck/actions/workflows/ci.yml)
|
|
27
|
+
[](./LICENSE)
|
|
28
|
+
|
|
29
|
+
A CLI tool to validate references and links in Markdown files (CommonMark spec).
|
|
30
|
+
It helps to ensure that your documentation is free from broken section links, missing images or files.
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- Validate local file paths in image and file references
|
|
35
|
+
- Check section links against actual headings, following [GitHub Flavored Markdown (GFM)](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links) rules, including cross-file references (e.g. `./subfolder/another-file.md#heading-link`)
|
|
36
|
+
- Detect broken reference-style links
|
|
37
|
+
- Basic email validation
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
### Cargo
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
cargo install mdrefcheck
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### PyPI
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install mdrefcheck
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
or run it directly in an isolated environment, e.g., with `uvx`:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
uvx mdrefcheck .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Pre-commit integration
|
|
60
|
+
|
|
61
|
+
Add this to your `.pre-commit-config.yaml`:
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
repos:
|
|
65
|
+
- repo: https://github.com/gospodima/mdrefcheck
|
|
66
|
+
rev: v0.1.7
|
|
67
|
+
hooks:
|
|
68
|
+
- id: mdrefcheck
|
|
69
|
+
```
|
|
70
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# mdrefcheck
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/mdrefcheck/)
|
|
4
|
+
[](https://crates.io/crates/mdrefcheck)
|
|
5
|
+
[](https://github.com/gospodima/mdrefcheck/actions/workflows/ci.yml)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
A CLI tool to validate references and links in Markdown files (CommonMark spec).
|
|
9
|
+
It helps to ensure that your documentation is free from broken section links, missing images or files.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Validate local file paths in image and file references
|
|
14
|
+
- Check section links against actual headings, following [GitHub Flavored Markdown (GFM)](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links) rules, including cross-file references (e.g. `./subfolder/another-file.md#heading-link`)
|
|
15
|
+
- Detect broken reference-style links
|
|
16
|
+
- Basic email validation
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
### Cargo
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cargo install mdrefcheck
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### PyPI
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install mdrefcheck
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
or run it directly in an isolated environment, e.g., with `uvx`:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uvx mdrefcheck .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Pre-commit integration
|
|
39
|
+
|
|
40
|
+
Add this to your `.pre-commit-config.yaml`:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
repos:
|
|
44
|
+
- repo: https://github.com/gospodima/mdrefcheck
|
|
45
|
+
rev: v0.1.7
|
|
46
|
+
hooks:
|
|
47
|
+
- id: mdrefcheck
|
|
48
|
+
```
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
pre-release-replacements = [
|
|
2
|
-
{file="pyproject.toml", search='version = "[a-z0-9\\.-]+"', replace='version = "{{version}}"'}
|
|
2
|
+
{file="pyproject.toml", search='version = "[a-z0-9\\.-]+"', replace='version = "{{version}}"'},
|
|
3
|
+
{file="README.md", search='rev: v[a-z0-9\\.-]+', replace='rev: v{{version}}'}
|
|
3
4
|
]
|
|
4
5
|
pre-release-commit-message = "chore(release): prepare for {{version}}"
|
|
@@ -8,9 +8,8 @@ pub fn validate_email(email: &str) -> Result<(), String> {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
/// Email validation according to https://spec.commonmark.org/0.31.2/#email-address
|
|
13
12
|
fn is_valid_email(s: &str) -> bool {
|
|
14
13
|
static EMAIL_RE: &str = r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$";
|
|
15
14
|
Regex::new(EMAIL_RE).unwrap().is_match(s)
|
|
16
|
-
}
|
|
15
|
+
}
|
|
@@ -3,11 +3,9 @@ use std::path::PathBuf;
|
|
|
3
3
|
use clap::Parser;
|
|
4
4
|
use regex::Regex;
|
|
5
5
|
|
|
6
|
-
// TODO: add dir exclusion similar to files
|
|
7
|
-
|
|
8
6
|
/// CLI configuration for mdrefcheck
|
|
9
7
|
#[derive(Parser, Debug)]
|
|
10
|
-
#[command(name = "mdrefcheck", about = "Check markdown references.")]
|
|
8
|
+
#[command(name = "mdrefcheck", about = "Check markdown references.", version)]
|
|
11
9
|
pub struct CliConfig {
|
|
12
10
|
/// Paths to check
|
|
13
11
|
#[arg(required = true, value_name = "PATH")]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use crate::utils::relative_path;
|
|
2
|
-
use std::path::Path;
|
|
3
2
|
use colored::Colorize;
|
|
3
|
+
use std::path::Path;
|
|
4
4
|
|
|
5
5
|
/// Represents a markdown validation issue (Ruff-compatible output)
|
|
6
6
|
pub struct ValidationError {
|
|
@@ -11,7 +11,12 @@ pub struct ValidationError {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
impl ValidationError {
|
|
14
|
-
pub fn new(
|
|
14
|
+
pub fn new(
|
|
15
|
+
path: &Path,
|
|
16
|
+
line: usize,
|
|
17
|
+
col: usize,
|
|
18
|
+
message: impl Into<String>,
|
|
19
|
+
) -> Self {
|
|
15
20
|
Self {
|
|
16
21
|
path: relative_path(path),
|
|
17
22
|
line,
|
|
@@ -23,6 +28,13 @@ impl ValidationError {
|
|
|
23
28
|
|
|
24
29
|
impl std::fmt::Display for ValidationError {
|
|
25
30
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
26
|
-
write!(
|
|
31
|
+
write!(
|
|
32
|
+
f,
|
|
33
|
+
"{}:{}:{}: {}",
|
|
34
|
+
self.path.bold(),
|
|
35
|
+
self.line,
|
|
36
|
+
self.col,
|
|
37
|
+
self.message
|
|
38
|
+
)
|
|
27
39
|
}
|
|
28
40
|
}
|
|
@@ -10,7 +10,7 @@ pub fn create_options() -> Options {
|
|
|
10
10
|
Options::ENABLE_FOOTNOTES | Options::ENABLE_WIKILINKS
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
/// Create HashSet of canonicalized paths from vector of paths
|
|
13
|
+
/// Create HashSet of canonicalized paths from vector of paths
|
|
14
14
|
pub fn create_file_set(vec_files: &Vec<PathBuf>) -> HashSet<PathBuf> {
|
|
15
15
|
vec_files
|
|
16
16
|
.iter()
|
|
@@ -18,11 +18,16 @@ pub fn create_file_set(vec_files: &Vec<PathBuf>) -> HashSet<PathBuf> {
|
|
|
18
18
|
.collect()
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/// Return a path relative to current working directory
|
|
21
|
+
/// Return a path relative to the current working directory
|
|
22
22
|
pub fn relative_path(target: &Path) -> String {
|
|
23
23
|
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
|
|
25
|
+
// Normalize target path first (fixes Windows \\?\ prefixes)
|
|
26
|
+
let normalized =
|
|
27
|
+
dunce::canonicalize(target).unwrap_or_else(|_| target.to_path_buf());
|
|
28
|
+
|
|
29
|
+
pathdiff::diff_paths(&normalized, cwd)
|
|
30
|
+
.unwrap_or(normalized)
|
|
26
31
|
.display()
|
|
27
32
|
.to_string()
|
|
28
33
|
}
|
mdrefcheck-0.1.5/CHANGELOG.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [0.1.4] - 2025-09-14
|
|
4
|
-
|
|
5
|
-
### CI
|
|
6
|
-
|
|
7
|
-
- Move cargo pyblish before artifacts staff
|
|
8
|
-
|
|
9
|
-
## [0.1.3] - 2025-09-14
|
|
10
|
-
|
|
11
|
-
### CI
|
|
12
|
-
|
|
13
|
-
- Put artifacts outside of repo to prevent dirty issues
|
|
14
|
-
|
|
15
|
-
## [0.1.3] - 2025-09-14
|
|
16
|
-
|
|
17
|
-
### CI
|
|
18
|
-
|
|
19
|
-
- Remove dist folder nesting on release
|
|
20
|
-
|
|
21
|
-
## [0.1.2] - 2025-09-14
|
|
22
|
-
|
|
23
|
-
### Documentation
|
|
24
|
-
|
|
25
|
-
- Adjust repo and home links to github
|
|
26
|
-
|
|
27
|
-
### CI
|
|
28
|
-
|
|
29
|
-
- Fix release steps
|
|
30
|
-
|
|
31
|
-
## [0.1.1] - 2025-09-14
|
|
32
|
-
|
|
33
|
-
### Documentation
|
|
34
|
-
|
|
35
|
-
- Define manual changelog file
|
|
36
|
-
|
|
37
|
-
### Other
|
|
38
|
-
|
|
39
|
-
- Upgrade deps
|
|
40
|
-
|
|
41
|
-
### Miscellaneous Tasks
|
|
42
|
-
|
|
43
|
-
- Adjust pre-release-commit-message
|
|
44
|
-
|
|
45
|
-
## [0.1.0] - 2025-07-06
|
|
46
|
-
|
|
47
|
-
### Features
|
|
48
|
-
|
|
49
|
-
- Initial commit
|
|
50
|
-
|
|
51
|
-
### Miscellaneous Tasks
|
|
52
|
-
|
|
53
|
-
- Initial pipeline, release, LICENSE
|
|
54
|
-
|
mdrefcheck-0.1.5/PKG-INFO
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: mdrefcheck
|
|
3
|
-
Version: 0.1.5
|
|
4
|
-
Classifier: Development Status :: 4 - Beta
|
|
5
|
-
Classifier: Environment :: Console
|
|
6
|
-
Classifier: Intended Audience :: Developers
|
|
7
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
-
Classifier: Programming Language :: Rust
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: Topic :: Documentation
|
|
11
|
-
Classifier: Topic :: Software Development :: Quality Assurance
|
|
12
|
-
Classifier: Topic :: Utilities
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
Summary: A CLI tool to validate references in markdown files.
|
|
15
|
-
Home-Page: https://github.com/gospodima/mdrefcheck
|
|
16
|
-
Author-email: gospodima <dimasc28@gmail.com>
|
|
17
|
-
License-Expression: MIT
|
|
18
|
-
Requires-Python: >=3.7
|
|
19
|
-
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
20
|
-
Project-URL: Repository, https://github.com/gospodima/mdrefcheck
|
|
21
|
-
|
|
22
|
-
# mdrefcheck
|
|
23
|
-
|
|
24
|
-
**mdrefcheck** is a CLI tool to validate references and links in Markdown files (CommonMark spec).
|
|
25
|
-
It helps ensure that your documentation is free from broken links, missing images, and invalid section anchors.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Features
|
|
30
|
-
|
|
31
|
-
- Validate local file paths in image and section references
|
|
32
|
-
- Check section links (`#heading-link`) match existing headings according to [GitHub Flavored Markdown (GFM)](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links) rules
|
|
33
|
-
- Identify broken reference-style links
|
|
34
|
-
- Email validation
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## Installation
|
|
39
|
-
|
|
40
|
-
From PyPI:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
pip install mdrefcheck
|
|
44
|
-
```
|
|
45
|
-
|
mdrefcheck-0.1.5/README.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# mdrefcheck
|
|
2
|
-
|
|
3
|
-
**mdrefcheck** is a CLI tool to validate references and links in Markdown files (CommonMark spec).
|
|
4
|
-
It helps ensure that your documentation is free from broken links, missing images, and invalid section anchors.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Features
|
|
9
|
-
|
|
10
|
-
- Validate local file paths in image and section references
|
|
11
|
-
- Check section links (`#heading-link`) match existing headings according to [GitHub Flavored Markdown (GFM)](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links) rules
|
|
12
|
-
- Identify broken reference-style links
|
|
13
|
-
- Email validation
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
From PyPI:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pip install mdrefcheck
|
|
23
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|