carpentries / styles

Styles for The Carpentries lessons. No README to avoid merge conflicts with lessons. Demo 👇
https://carpentries.github.io/lesson-example
Other
84 stars 96 forks source link

bin/lesson_check.py: allow exceptions to line length limit #594

Closed maxim-belkin closed 3 years ago

maxim-belkin commented 3 years ago

Allow lines that contain a single image or a single link to go over the suggested line length limit. So, all of the following lines will be allowed to go over the line limit:

[alt text](/some/url)
![alt text](/path/to/image)
[alt text][internal_link]
![alt text][internal_link_to_image]

Plus all of the above prefixed with any combination of > and to allow these lines to go over the limit in various code blocks.

Fixes carpentries/styles#591

fmichonneau commented 3 years ago

Thanks Maxim!

maxim-belkin commented 3 years ago

Thanks, François!

@jhlegarreta, could you please confirm that after this change make lesson-check-all doesn't complain about the long lines that contain images or links only?

jhlegarreta commented 3 years ago

The regex does not seem straightforward ! Thanks both :+1:.

@jhlegarreta, could you please confirm that after this change make lesson-check-all doesn't complain about the long lines that contain images or links only?

Will give it a try when I find the time (will try during the weekend) and will report back.

jhlegarreta commented 3 years ago

Unfortunately, it does not look like it solved the issue. In fact, the number of warnings has increased, e.g.: https://github.com/carpentries-incubator/SDC-BIDS-dMRI/runs/2531577900?check_suite_focus=true#step:16:20 with respect to an immediately previous version, e.g. https://github.com/carpentries-incubator/SDC-BIDS-dMRI/runs/2528767166?check_suite_focus=true#step:16:20

In the previous version, link-only lines (e.g. line 190 at the pointed file - __episodes/constrained_spherical_deconvolution.md) were not triggering warnings, and now they are. Meanwhile, the lines that made me open (e.g. line 458) the issue are still raising the warnings.

maxim-belkin commented 3 years ago

Oh, I see what the problem is. The pattern I added doesn't allow {:class ...}at the end. I'll fix that.

maxim-belkin commented 3 years ago

So, I found a few things that you use in your lesson that I didn't take into account when I was working on this pattern:

  1. You use links in headings
  2. You use {:class=...} customizations in link/image-only lines
  3. You use \ at the end of the image/link-only lines

So, #597 should address all of these.