Pre-commit hooks for hyperlinks

Alvin Wong alvin at alvinhc.com
Tue Feb 7 19:44:40 GMT 2023


Not counting the case of wanting to display some text between square 
brackets (which probably is extremely rare), Markdown also has 
[reference links][reference-link] (Hugo is CommonMark compliant), so it 
is possible to have legitimate Markdown source contain a space between a 
closing bracket `[` and an opening parenthesis.

There are other special cases for inline links. For example, space in 
links is supported if the link is enclosed in angled brackets `<>`, and 
link titles also requires adding a space after the link.

Perhaps having a warning is okay if it doesn't get too noisy, but 
blocking such commits entirely seems like a bad idea to me. Anyway, 
isn't it better to have the translation tool (e.g. Lokalize) do the 
checks instead?

[reference-link]: https://spec.commonmark.org/0.30/#reference-link

On 5/1/2023 3:29, Johnny Jazeix wrote:
> Hi,
>
> +1 if it is doable. It happens a lot too in French translation where 
> we add unwanted spaces and having a hook preventing the commit and 
> showing the issue would be really great!
>
> Johnny
>
> Le mer. 4 janv. 2023 à 20:27, Łukasz Wojniłowicz 
> <lukasz.wojnilowicz at gmail.com> a écrit :
>
>     Hi all,
>
>     would it be possible to add pre-commit hooks before pushing to svn,
>     which would detect following faulty hyperlinks?:
>
>     1. [valid text](https://invalid.url.with.a.space.in/ it)
>     2. [valid text] (https://valid.url)
>
>     Above syntax would be rendered literally (as not expected) and not
>     as hyperlinks (as expected) on the KDE website.
>
>     Cheers
>     Łukasz
>


More information about the kde-i18n-doc mailing list