Metadata-Version: 2.4
Name: link-sweep
Version: 0.1.1
Summary: A tool for checking and cleaning dead links in Markdown files for SSGs
Project-URL: Repository, https://github.com/m0ddr/link-sweep
Project-URL: Issues, https://github.com/m0ddr/link-sweep/issues
Project-URL: Documentation, https://github.com/m0ddr/link-sweep#readme
Author: Kieran (Modder)
License: MIT
License-File: LICENSE
Keywords: ci-cd,hugo,jekyll,link-checker,links,markdown,static-site-generator,zola
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Documentation
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Text Processing :: Markup :: Markdown
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Requires-Dist: click>=8.0.0
Requires-Dist: httpx>=0.24.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# Link Sweep

Link Sweep is a tool for checking and cleaning dead links specifically within Markdown files for use with static site generators like Zola, Hugo, and Jekyll. Dead links have a negative impact on SEO, security and user experience.
This tool was inspired by [DeadFinder](https://github.com/hahwul/deadfinder) and designed to be more lightweight, tailored to my specific needs.

This tool is vastly more limited in scope, being designed specifically for recursively targeting markdown files within a given directory. For broader use cases, I recommend [DeadFinder](https://github.com/hahwul/deadfinder)

## Installation

### From PyPI (Recommended)

```bash
pip install link-sweep
```

### From Source

```bash
git clone https://github.com/yourusername/link-sweep.git
cd link-sweep
pip install -e .
```

## Usage

```bash
# Check links in your content directory
link-sweep check-links content/

# Check with verbose output
link-sweep check-links --verbose content/

# Check and automatically remove dead links (no back-up)
link-sweep check-links --remove-dead content/
```
When using `--remove-dead`, dead links like `[Example](https://dead-link.com)` become just `Example`.

## GitHub Actions Integration

This script was designed with the intention of running as part of GitHub Actions, however, it can be run manually. A generic workflow might look something like this:
```yaml
name: Weekly Link Cleanup

on:
  schedule:
    - cron: '0 6 * * 1'  # Monday 6 AM

jobs:
  cleanup:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    
    - name: Fix dead links
      run: link-sweep check-links --remove-dead content/
    
    - name: Create PR if changes
      uses: peter-evans/create-pull-request@v5
      with:
        commit-message: "fix: automated dead link cleanup"
        title: "🔧 Weekly dead link cleanup"
```
The above runs weekly to create a pull request if there are any changes captured within the runner's local files.

## License
MIT License - see LICENSE file for details.

## Changelog

### v0.1.1
- Basic link checking functionality
- Dead link removal option
- CLI interface with Click
- Concurrency for improved perforamance
- Link timeouts