best-of-lists / best-of-generator

🏆 Generates a ranked list of awesome libraries and tools.
https://best-of.org
GNU General Public License v3.0
79 stars 14 forks source link

Add `max_description_length` config option #40

Closed tpvasconcelos closed 3 years ago

tpvasconcelos commented 3 years ago

Feature description: Add a max_description_length configuration option, i.e.

configuration:
   max_description_length: 100

The code change should be minimal here. Since we are already passing a configuration dictionary into generate_project_md(), we could just replace 55 with configuration.max_description_length. In addition to this, we would also have to add the following to prepare_configuration:

if "max_description_length" not in config:
    config.max_description_length = 55

You could also consider allowing for None, which would remove the limit. I don't think that there is a (reasonable) limit to GitHub's description field. Therefore, I would vote for not doing this and instead requiring an explicit int limit.

Problem and motivation:

Currently, the default is value is 55. From the source code: The goal is that it fits into one row in most cases.. I am OK with this as a default as I agree that it is aesthetically more pleasing. However, I believe it would be a nice feature to add a configurable maximum value. Currently, I have some projects with a custom description (overwriting the default description from GitHub). It's a bit annoying that this is not shown in the final render.

Is this something you're interested in working on?

Yes

tpvasconcelos commented 3 years ago

41 implements this change for markdown_list.py. Same could be done for markdown_gallery.py (which defaults to 90). I want to hear from you first before discussing how/if to do this

lukasmasuch commented 3 years ago

@tpvasconcelos Thanks for the contribution :) Adding this configuration makes sense! I will merge your PR, include the config in markdown_gallery.py as well, and roll out a new version later today.

tpvasconcelos commented 3 years ago

@LukasMasuch awesome! Looking forward to the next release 🚀

lukasmasuch commented 3 years ago

@tpvasconcelos The version 0.7.2 is released with your addition! See here and here.