Skip to content

Commit

Permalink
Merge pull request #2 from klieret/improve-readme
Browse files Browse the repository at this point in the history
Improve readme
  • Loading branch information
klieret committed Aug 30, 2021
2 parents f8cf11b + 30ff77c commit 1dc84c1
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions README.md
@@ -1,4 +1,4 @@
# Jekyll: Hook to enforce URLs relative to site.baseurl
# Jekyll: Enforce enforce URLs relative to site.baseurl 🔗✔️

[![gh actions](https://github.com/klieret/jekyll-relative-url-check/actions/workflows/test.yaml/badge.svg)](https://github.com/klieret/jekyll-relative-url-check/actions)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/klieret/jekyll-relative-url-check/main.svg)](https://results.pre-commit.ci/latest/github/klieret/jekyll-relative-url-check/main)
Expand All @@ -12,9 +12,7 @@ in a Jekyll project are relative to `{{ site.baseurl }}`.
The reasoning behind this is that links like `[link](/absolute/link)` will break if the site is not
directly deployed at `domain.com`, but e.g. at `user.github.io/projectname`.

## Examples

The following lines should raise errors:
For example, the following lines should raise errors:

Markdown:

Expand All @@ -30,7 +28,20 @@ href="/absolute/link"
src="/absolute/picture.png"
```

## Installation
## 📦 Installation & usage

### 🎣 As a pre-commit hook

#### Test it

Simply run the following (no explicit installation required)

```bash
pre-commit try-repo https://github.com/klieret/jekyll-relative-url-check jekyll-relative-url-check-html --verbose --all-files
pre-commit try-repo https://github.com/klieret/jekyll-relative-url-check jekyll-relative-url-check-markdown --verbose --all-files
```

#### Install it

Include the following snippet in your pre-commit config

Expand All @@ -45,12 +56,20 @@ repos:

Afterwards run `pre-commit autoupdate` to replace `main` with the latest release.

## False positives
### 🔨 As a script

```bash
pip3 install .
jekyll-relative-url-check-html [FILE]...
jekyll-relative-url-check-markdown [FILE]...
```

## ⏫ Advanced usage

* Include `JEKYLL_RELATIVE_URL_CHECK_SKIP_FILE` in a file to skip checking the entire
file.
* Include `JEKYLL_RELATIVE_URL_CHECK_SKIP_LINE` in a line to skip checking it

## Implementation
## 💻 Implementation

Currently this hook only works by checking for several simple regular expressions.

0 comments on commit 1dc84c1

Please sign in to comment.