becheran/mlc

Option to check links in code blocks

Opened this issue · 2 comments

Is your feature request related to a problem? Please describe.
We have some links that are inside of code blocks, particularly to download config files as part of an installation process. It is important that these links are correct, but unfortunately mlc ignores them.

Describe the solution you'd like
A command line option to check links inside of code blocks.

Describe alternatives you've considered
Moving the links out of code blocks. This is not a good solution because its necessary to mention the specific commands for users who are not familiar with Linux/bash.

Additional context
Example:

# download default config files
wget https://raw.githubusercontent.com/LemmyNet/lemmy/release/v0.17/docker/prod/docker-compose.yml
wget https://raw.githubusercontent.com/LemmyNet/lemmy/release/v0.17/docker/lemmy.hjson

# start the server
docker-compose up -d

I can definitely see how this feature can be useful. Though I am not sure how exactly this should look like.

Right now every code block is simply ignored. I think it doesn't make much sense to parse for markdown links in a code block since it is most likely not markdown but some arbitrary other syntax.

So my question would then be how to detect a link in code blocks? Simply by scanning the text for http(s):// strings? Would that be enough?

Yes exactly, scanning for http(s):// strings would be perfect for my purposes. If you want to make it more flexible you could also add a command line parameter for the url protocols that are checked in code blocks. But maybe thats not worth the effort.