-
Notifications
You must be signed in to change notification settings - Fork 1
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
Remapping file-extension: .md to .html #1
Comments
I thought I answered that in a separate issue, but I can't remember right now, so here are some thoughts. As the error message says, the second parameter of the remap must be a valid URI. ❯ lychee --max-concurrency 8 --remap "(.*).md https://tgaff.github.io/some-gh-pages-site/ $1.html" index.md I don't know if this works, but it's worth a try. You might need the |
I made a few attempts based on this an still can't seem to get it to work. It seems a lot like the capture group isn't capturing. Any ideas? First try:
Result:
remove spaceI think maybe the space was a typo - tried again without it, for a different message:
It seems like the capture group didn't work again. Try with
|
Yup, the capture group is not working. This is fixed in master, I hope. Can you try again with this? uses: lycheeverse/lychee-action@master Still need to release that version. |
❯ lychee --max-concurrency 8 --remap "(.*).md https://tgaff.github.io/some-gh-pages-site/$1.html" index.md 2/2 ETA 0s ████████████████████ Finished extracting links Issues found in 1 input. Find details below. [index.md]: ✗ [404] https://tgaff.github.io/some-gh-pages-site/.html | Failed: Network error: Not Found 🔍 2 Total ✅ 1 OK 🚫 1 Error (HTTP:1)
I was actually running it locally so I setup an action to test it using the master branch. That run is here ... I think its still a failure, though I did have some quotes issues and its possible its my fault. |
I noticed that you're using single quotes in the linked run. --max-concurrency 8 --remap '(.*).md https://tgaff.github.io/some-gh-pages-site/$1.html' index.md Did you try double quotes as well? --max-concurrency 8 --remap "(.*).md https://tgaff.github.io/some-gh-pages-site/$1.html" index.md If that doesn't work, try to escape the double quotes |
I gave it a shot and I get the same I may be on an older version now though. I imagine there's been a release since the last time I checked on this. |
Yup. The latest release contains some changes around remapping, so it might be worth a shot. |
OK, I moved from 0.13 to 0.14.1. This version behaves quite differently. 👍 Initially, I tried the same thing we were discussing: ❯ lychee --max-concurrency 8 --remap '(.*).md https://tgaff.github.io/some-gh-pages-site/$1.html' index.md
2/2 ━━━━━━━━━━━━━━━━━━━━ Finished extracting links Issues found in 1 input. Find details below.
[index.md]:
✗ [404] https://tgaff.github.io/some-gh-pages-site/file:///Users/tgaff/devel/guides/technical_guides/chef.html | Failed: Network error: Not Found
✗ [404] https://tgaff.github.io/some-gh-pages-site/file:///Users/tgaff/devel/guides/technical_guides/css.html | Failed: Network error: Not Found You can see that the capture group is capturing everything up to the top level directory (note the ❯ lychee --max-concurrency 8 --remap 'file:\/\/\/Users\/tgaff\/devel\/guides\/(.*).md https://tgaff.github.io/some-gh-pages-site/$1.html' index.md
2/2 ━━━━━━━━━━━━━━━━━━━━ Finished extracting links 🔍 2 Total (in 0s) ✅ 2 OK 🚫 0 Errors Since I do want to check sub-directories I think I'm stuck with this slightly cumbersome path statement. It works though. 👍 Does this belong in the remaps list? One final thing, since the page contains some links that start with |
I'm still trying to understand what's the difference in your regex such that it doesn't capture the protocol in your first version, but it does so in the second version. Apart from that, yes, that should go into the remaps list. |
The first version uses a capture group that is exceedingly greedy. My understanding is that only the capture group is used in the remap. |
Ah, got it. Thanks. I have two small tips for you. First, you can simplify your regex like this:
Second, you can quickly experiment with regex ideas by using echo 'file:///Users/tgaff/devel/guides/technical_guides/chef.md' | lychee --dump --remap 'file:///.*/(.*).md$ https://guides.labzero.com/$1.html' - If you have the time, I'd be thankful for a pull request to the remaps list. 😃 |
Thanks, I assumed I needed to escape the
This won't quite work, because I do need to capture all of the path after the repo's root, so that it's mapped in as well. Imagine my repo is at
I need to capture the directory names I'll try to get to a PR here soon. |
You can capture the last path as well: echo 'file:///Users/tgaff/devel/guides/technical_guides/chef.md' | lychee --dump --remap 'file:///.*/([^/]+/[^/]+)\.md$ https://guides.labzero.com/$1.html' -
https://guides.labzero.com/technical_guides/chef.html Or you can also introduce a second capture parameter. echo 'file:///Users/tgaff/devel/guides/technical_guides/chef.md' | lychee --dump --remap 'file:///.*/([^/]+)/([^/]+)\.md$ https://guides.labzero.com/$1/$2.html' -
https://guides.labzero.com/technical_guides/chef.html |
I have a GitHub pages site written in markdown. I want to test the live deployed links from the site. Lychee doesn't support recursion or crawling the site but I thought I could use
--base
and--remap
to generate the links to check from the original markdown before it's turned to HTML.index.md contains a link like
I expected the capture group $1 to contain
/bad-links/nested/page
and to append.html
. Instead I get an error.Is there any way to accomplish this?
The text was updated successfully, but these errors were encountered: