Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check GitHub markdown section links #312

Merged
merged 1 commit into from
May 21, 2024
Merged

Conversation

rkitover
Copy link
Contributor

@rkitover rkitover commented Apr 5, 2024

Extract markdown heading lines and convert to section link names, check all section links against this list and return a 404 for any that do not have a heading.

Filter out code blocks because comments can be false positives for markdown headers.

Make some minor adjustments for the tests to pass on Windows.

Fix #250

@rkitover rkitover force-pushed the section-links branch 2 times, most recently from a005469 to 8a8e477 Compare April 12, 2024 00:23
Extract markdown heading lines and convert to section link names, check
all section links against this list, first removing any code blocks, and
return a 404 for any that do not have a heading.

Check for `baseUrl` option prepended section links as well.

Add tests for this functionality.

Make some minor adjustments for the tests to pass on Windows.

Fix tcort#250

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
@rkitover
Copy link
Contributor Author

@tcort I have added tests.

@rkitover
Copy link
Contributor Author

@tcort ping, can you take a look please, I need this feature to work on my document and other people would appreciate it too

@rkitover
Copy link
Contributor Author

@tcort ping again. I hope you are doing well. I will wait a couple more weeks for you to respond then I will have to fork this module, which I would really prefer to avoid.

@tcort tcort merged commit 7e9668f into tcort:master May 21, 2024
@rkitover rkitover deleted the section-links branch May 21, 2024 17:04
@rkitover
Copy link
Contributor Author

Thank you, I really appreciate this, hope you can get a new release out soon.

cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/bazel-starlib May 22, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [markdown-link-check](https://github.com/tcort/markdown-link-check)
| dependencies | patch | [`3.12.1` ->
`3.12.2`](https://renovatebot.com/diffs/npm/markdown-link-check/3.12.1/3.12.2)
|

---

### Release Notes

<details>
<summary>tcort/markdown-link-check (markdown-link-check)</summary>

###
[`v3.12.2`](https://github.com/tcort/markdown-link-check/releases/tag/v3.12.2)

[Compare
Source](https://github.com/tcort/markdown-link-check/compare/v3.12.1...v3.12.2)

#### What's Changed

- fix status badge in README by
[@&#8203;dklimpel](https://github.com/dklimpel) in
[https://github.com/tcort/markdown-link-check/pull/303](https://github.com/tcort/markdown-link-check/pull/303)
- enable skipped tests for hash links by
[@&#8203;dklimpel](https://github.com/dklimpel) in
[https://github.com/tcort/markdown-link-check/pull/306](https://github.com/tcort/markdown-link-check/pull/306)
- chore(deps): bump actions/setup-node from 3 to 4 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/300](https://github.com/tcort/markdown-link-check/pull/300)
- chore: Upgrade to ESLint 9 by
[@&#8203;nschonni](https://github.com/nschonni) in
[https://github.com/tcort/markdown-link-check/pull/318](https://github.com/tcort/markdown-link-check/pull/318)
- Check GitHub markdown section links by
[@&#8203;rkitover](https://github.com/rkitover) in
[https://github.com/tcort/markdown-link-check/pull/312](https://github.com/tcort/markdown-link-check/pull/312)
- docs: add example for GitLab pipeline by
[@&#8203;dklimpel](https://github.com/dklimpel) in
[https://github.com/tcort/markdown-link-check/pull/309](https://github.com/tcort/markdown-link-check/pull/309)
- ci: Use matrix for cross-OS testing by
[@&#8203;nschonni](https://github.com/nschonni) in
[https://github.com/tcort/markdown-link-check/pull/307](https://github.com/tcort/markdown-link-check/pull/307)
- chore(deps): bump actions/checkout from 3 to 4 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/301](https://github.com/tcort/markdown-link-check/pull/301)
- chore(deps): bump commander from 10.0.1 to 12.1.0 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/322](https://github.com/tcort/markdown-link-check/pull/322)
- chore(deps-dev): bump eslint from 8.57.0 to 9.3.0 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/321](https://github.com/tcort/markdown-link-check/pull/321)
- chore(deps-dev): bump mocha from 10.3.0 to 10.4.0 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/311](https://github.com/tcort/markdown-link-check/pull/311)
- chore(deps-dev): bump express from 4.18.3 to 4.19.1 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/308](https://github.com/tcort/markdown-link-check/pull/308)
- chore(deps-dev): bump express from 4.18.3 to 4.19.2 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/310](https://github.com/tcort/markdown-link-check/pull/310)

#### New Contributors

- [@&#8203;rkitover](https://github.com/rkitover) made their first
contribution in
[https://github.com/tcort/markdown-link-check/pull/312](https://github.com/tcort/markdown-link-check/pull/312)

**Full Changelog**:
tcort/markdown-link-check@v3.12.1...v3.12.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://github.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDkuNCIsInVwZGF0ZWRJblZlciI6IjM2LjEwOS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
renovate bot referenced this pull request in open-feature/spec May 25, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [markdown-link-check](https://github.com/tcort/markdown-link-check)
| [`3.11.2` ->
`3.12.2`](https://renovatebot.com/diffs/npm/markdown-link-check/3.11.2/3.12.2)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/markdown-link-check/3.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/markdown-link-check/3.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/markdown-link-check/3.11.2/3.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/markdown-link-check/3.11.2/3.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>tcort/markdown-link-check (markdown-link-check)</summary>

###
[`v3.12.2`](https://github.com/tcort/markdown-link-check/releases/tag/v3.12.2)

[Compare
Source](https://github.com/tcort/markdown-link-check/compare/v3.12.1...v3.12.2)

#### What's Changed

- fix status badge in README by
[@&#8203;dklimpel](https://github.com/dklimpel) in
[https://github.com/tcort/markdown-link-check/pull/303](https://github.com/tcort/markdown-link-check/pull/303)
- enable skipped tests for hash links by
[@&#8203;dklimpel](https://github.com/dklimpel) in
[https://github.com/tcort/markdown-link-check/pull/306](https://github.com/tcort/markdown-link-check/pull/306)
- chore(deps): bump actions/setup-node from 3 to 4 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/300](https://github.com/tcort/markdown-link-check/pull/300)
- chore: Upgrade to ESLint 9 by
[@&#8203;nschonni](https://github.com/nschonni) in
[https://github.com/tcort/markdown-link-check/pull/318](https://github.com/tcort/markdown-link-check/pull/318)
- Check GitHub markdown section links by
[@&#8203;rkitover](https://github.com/rkitover) in
[https://github.com/tcort/markdown-link-check/pull/312](https://github.com/tcort/markdown-link-check/pull/312)
- docs: add example for GitLab pipeline by
[@&#8203;dklimpel](https://github.com/dklimpel) in
[https://github.com/tcort/markdown-link-check/pull/309](https://github.com/tcort/markdown-link-check/pull/309)
- ci: Use matrix for cross-OS testing by
[@&#8203;nschonni](https://github.com/nschonni) in
[https://github.com/tcort/markdown-link-check/pull/307](https://github.com/tcort/markdown-link-check/pull/307)
- chore(deps): bump actions/checkout from 3 to 4 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/301](https://github.com/tcort/markdown-link-check/pull/301)
- chore(deps): bump commander from 10.0.1 to 12.1.0 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/322](https://github.com/tcort/markdown-link-check/pull/322)
- chore(deps-dev): bump eslint from 8.57.0 to 9.3.0 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/321](https://github.com/tcort/markdown-link-check/pull/321)
- chore(deps-dev): bump mocha from 10.3.0 to 10.4.0 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/311](https://github.com/tcort/markdown-link-check/pull/311)
- chore(deps-dev): bump express from 4.18.3 to 4.19.1 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/308](https://github.com/tcort/markdown-link-check/pull/308)
- chore(deps-dev): bump express from 4.18.3 to 4.19.2 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/tcort/markdown-link-check/pull/310](https://github.com/tcort/markdown-link-check/pull/310)

#### New Contributors

- [@&#8203;rkitover](https://github.com/rkitover) made their first
contribution in
[https://github.com/tcort/markdown-link-check/pull/312](https://github.com/tcort/markdown-link-check/pull/312)

**Full Changelog**:
tcort/markdown-link-check@v3.12.1...v3.12.2

###
[`v3.12.1`](https://github.com/tcort/markdown-link-check/blob/HEAD/CHANGELOG.md#Version-3121)

[Compare
Source](https://github.com/tcort/markdown-link-check/compare/v3.12.0...v3.12.1)

- fix: fix crash
[#&#8203;297](https://github.com/tcort/markdown-link-check/issues/297)
[@&#8203;CanadaHonk](https://github.com/CanadaHonk)
- Set `ipv4first` for tests in CI
[@&#8203;dklimpel](https://github.com/dklimpel)
- Bump node for release
[@&#8203;dklimpel](https://github.com/dklimpel)

###
[`v3.12.0`](https://github.com/tcort/markdown-link-check/blob/HEAD/CHANGELOG.md#Version-3120)

[Compare
Source](https://github.com/tcort/markdown-link-check/compare/v3.11.2...v3.12.0)

- feat: add basic ignore subpaths argument
[@&#8203;CanadaHonk](https://github.com/CanadaHonk)
- feat: add global option to replacementPatterns
[@&#8203;CanadaHonk](https://github.com/CanadaHonk)
- refactor: replace url.parse with new URL
[@&#8203;CanadaHonk](https://github.com/CanadaHonk)
- docs: update readme to be clearer for projectBaseUrl opt
[@&#8203;nwcm](https://github.com/nwcm)
- feat: Add support to load md files via proxy
[@&#8203;dklimpel](https://github.com/dklimpel)
-   chore: upgrade dependencies

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-feature/spec).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzguMSIsInVwZGF0ZWRJblZlciI6IjM3LjM2OC4xMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

404 on links to section headers that exist in the same file
2 participants