wpreadme2markdown / wp-readme-to-markdown

Convert WordPress Plugin Readme Files to GitHub Flavored Markdown
MIT License
92 stars 20 forks source link

Screenshots aren't generated correctly? #17

Closed dashaluna closed 3 years ago

dashaluna commented 9 years ago

Sorry I can't figure out how to get screenshots generated correctly.

Here is what I have in my readme.txt:

== Screenshots ==

1. WordPress Admin: Plugins page - a summary of the plugin with quick action links to plugin's Settings and documentation on github webiste.
2. WordPress Admin: Settings page - plugin's default settings. These settings will be used when a shortcode is specified without attributes. Shortcode attribute takes precedence over default settings.

And here is what gets generated:

## Screenshots ##

###1. WordPress Admin: Plugins page - a summary of the plugin with quick action links to plugin's Settings and documentation on github webiste.###
[missing image]
###2. WordPress Admin: Settings page - plugin's default settings. These settings will be used when a shortcode is specified without attributes. Shortcode attribute takes precedence over default settings.###
[missing image]

I tried with my screenshot files in the main plugin directory and in assets subdirectory - the output is the same. All my screenshots are png and named screenshot-x where x is the number from the list in the readme file.

Thank you.

johnbillion commented 9 years ago

Turns out this is being caused because @dashaluna's plugin isn't in the plugin directory yet, so the validateUrl() calls all fail.

Probably not much that can be done about this.

JJJ commented 4 years ago

I tracked this issue down to this slug guessing code:

https://github.com/wpreadme2markdown/wp-readme-to-markdown/blob/master/src/Converter.php#L52

Specific to my needs and this issue, the plugin name is not an adequate foundation to guess the plugin slug.

For: https://wordpress.org/plugins/sugar-calendar-lite/

The file extension check in findScreenshot() also seems to find PNGs when JPGs are what's there.

I end up with:

http://ps.w.org/simple-event-management-–-sugar-calendar-(lite)/assets/screenshot-1.png

When I need:

https://ps.w.org/sugar-event-calendar/assets/screenshot-1.jpg

I think a PR should be achievable to correct both of these issues.

sunchaserinfo commented 4 years ago

@JJJ you can supply the slug manually if it is detected incorrectly:

$markdown = \WPReadme2Markdown\Converter::convert($readme, 'my-slug-here');