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

Don't report links in code blocks #20

Open
lue-bird opened this issue Feb 16, 2024 · 1 comment
Open

Don't report links in code blocks #20

lue-bird opened this issue Feb 16, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@lue-bird
Copy link

Applies to

If you include a link to a code example:
```elm
module A exposing (A)
{-| Helpers for [`B.B`](B#B)
-}
import B
```

it triggers both rules

Docs.ReviewLinksAndSections: Link points to non-existing module Expression

202|     module A exposing (A)
203|     {-| Helpers for [`B.B`](B#B)
                           ^^^
204|     -}

This is a dead link.
Docs.UpToDateReadmeLinks: Found relative link to a module in README

202|     module A exposing (A)
203|     {-| Helpers for [`B.B`](B#B)
                           ^^^
204|     -}

Relative links to other modules from the README don't work when looking at the
docs from GitHub or the likes.

I suggest to run elm-review --fix to change the link to an absolute link.

which is not correct because these are not real links that are rendered as such, they are code.

Treat this as a very low prio as checking for it is a bit of work and should only be quite rare in practice.

For implementation we could for example remove all sections from starting-spaced ``` until the next spaced ``` before checking.

@jfmengels jfmengels added bug Something isn't working help wanted Extra attention is needed labels Feb 16, 2024
@jfmengels
Copy link
Owner

Good find 👍

For implementation we could for example remove all sections from starting-spaced until the next spaced before checking.

We also need to check for indentation blocks. If you have lines that are indented by 4 (maybe with an empty line above?) then it gets considered as an Elm code block (you'll seen elm-format try to update it). In which case we also need to ignore it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants