-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
How to ignore .md in a link? #178
Comments
Hum... for me it sounds like an optimization we must do... Let me check that ASAP and come back to you. |
This is the first time I've seen a valid reason for the labels "bug" and "enhancement" to be applied to the same issue. 👍 |
So we came up with a hack to get around it. Your regex is looking for the whole '.md'. We can use ascii to swap out the . and then use % encoded value: '%2Emd'. This gets it around the current problem, but there should be a better way to do it. |
That's unfortunate, I don't see a lot of options. We could check that the file exists in the repository? Hopefully it won't be tricky with relative paths and absolute… |
Why couldn't Couscous ignore's external URLs by checking the domain against the |
@stephenharris that's a good idea, maybe we could also check whether the URL is relative or absolute to another domain? |
@mnapoli Yes, so if the url (relative or an absolute) evaluates to something under the baseUrl it is parsed. Absolute urls to other (sub-?)domains is ignored. The regex for that would need some thought. I'm not familiar with Couscous' internals, but happy to attempt a PR if the above seems reasonable. |
@stephenharris if you want to give it a go, here is the test: https://github.com/CouscousPHP/Couscous/blob/master/tests/UnitTest/Module/Markdown/Step/RewriteMarkdownLinksTest.php and the class containing the regex: https://github.com/CouscousPHP/Couscous/blob/master/src/Module/Markdown/Step/RewriteMarkdownLinks.php (that regex looks fun :) ) I'm not sure I understand fully what you suggest, here is what I have in mind:
So it should be a matter of rewriting the regex so that it doesn't match anything that starts with |
Leaving absolute URLs alone, is probably the correct solution here. I do however, have a clean workaround for the time being. HTML tags are acceptable in markdown and get left alone by couscous. Changing a link like this:
to this:
seems to workaround the issue well. |
Couscous is changing a external URL that ends in .md to .html (like is should) but in this case its to a repo outside of where couscous is running, so we need the .md. Can we flag the url string somehow so couscous will ignore it and set the link to the correct .md path?
The text was updated successfully, but these errors were encountered: