processwire-requests icon indicating copy to clipboard operation
processwire-requests copied to clipboard

Integrate README.md display in module config screen

Open jmartsch opened this issue 1 year ago • 10 comments

Please integrate the ability to display the contents of a module's README.md file directly within the module's configuration screen in the ProcessWire admin. This would be similar to what github or npmjs is doing. image Screenshot is taken from ModuleReleaseNotes which provides the functionality i mentioned.

Benefits

Many modules come with a README.md file that contains valuable information, such as setup instructions, configuration details, usage examples, and more. Currently, if developers want to show this information in the config screen, they would need to use the getInputfields method and manually add fields with markup, which can be time-consuming and prone to errors. Displaying the README.md content directly can simplify this and ensure that users always see the most updated documentation without having to leave the admin interface.

  • Simplified Development: Module developers no longer need to duplicate instructions or information in the getInputfields method.
  • Enhanced User Experience: End-users can access all essential module details without leaving the admin interface.
  • Maintainability: One single source (the README.md file) ensures consistent and updated information is displayed, reducing the likelihood of outdated or conflicting instructions.

Proposed Implementation:

  • Check for the existence of a README.md file in the module's directory.
  • If the file exists, parse its Markdown content and convert it to HTML.
  • Display the HTML content in a dedicated section on the module's configuration screen. This way, whenever the README.md is updated, the changes would automatically reflect in the module's config screen without any additional adjustments.

I think that this feature would be a valuable addition, streamlining both the module development and configuration processes. I would greatly appreciate your consideration of this request and am open to any feedback or further discussions.

jmartsch avatar Aug 09 '23 08:08 jmartsch

FYI, ModuleReleaseNotes has this feature.

As well as supporting the discovery of changes prior to upgrade, the module makes the support files that normally accompany a module readable from the Module's information page in the admin interface. Each file starting with README, CHANGELOG and LICENSE can be displayed and browsed.

Toutouwai avatar Aug 09 '23 08:08 Toutouwai

@Toutouwai Thanks for the hint. ,The screenshot in the request is taken from that module. I updated this in my request, but still I think it would be a good addition to the core instead of using another module.

jmartsch avatar Aug 09 '23 08:08 jmartsch

Thanks @jmartsch I have added a README.md viewer to the module config screen. In this case, I didn't want to render the the readme contents unless/until the user clicks a link to do so, so it's a little different and smaller scope than ModuleReleaseNotes, but still quite useful I think.

ryancramerdesign avatar Feb 02 '24 20:02 ryancramerdesign

@ryancramerdesign this is a great update, thx!

I think it's a good idea to NOT render the readme.md automatically, as it could often be long with lots of informations...

One additional request, though: Could you add another file, maybe info.md or pw-info.md, that shows up automatically?

I'm having this on all my modules:

image

Nobody will have a look if that's hidden behind a link.

Many great modules add a donate button (as often requested by the community) and at the moment its not that hard, but also not as easy as it could be:

TracyDebugger:

image

Fluency:

image

If info.md or maybe pw-info.md was rendered automatically adding a donation button would be as simple as this:

Module developers are dedicated members of the ProcessWire community and an important component of the ecosystem. Many hours and hard work are put into developing and maintaining modules that create great developer and end user experiences. Consider donating to developers of the modules you find most useful or are a consistent part of your projects!

<img src="/site/modules/Fluency/assets/img/paypal_me.png" alt="PayPal Me">

Thx!

BernhardBaumrock avatar Feb 02 '24 20:02 BernhardBaumrock

@BernhardBaumrock Nice, that sounds useful. I will plan to add it before bumping the version 3.0.236 next week.

ryancramerdesign avatar Feb 02 '24 20:02 ryancramerdesign

Great, thx @ryancramerdesign

BernhardBaumrock avatar Feb 02 '24 20:02 BernhardBaumrock

Regarding @BernhardBaumrock comment

I think it's a good idea to NOT render the readme.md automatically, as it could often be long with lots of informations...

I think that this should be in a collapsible, which could be closed by default. Thats how it works in ModuleReleaseNotes also, if I remember correctly

jmartsch avatar Feb 02 '24 23:02 jmartsch

@ryancramerdesign I forgot one important detail to make this work for my automated setup :D

Could you please also expose the module's name to the pw-info.md ? Then I could use generic info files like this and you would save me from adjusting all manually for every single module:

This is what I'm using at the moment:

    $name = strtolower($this);
    $inputfields->add([
      'type' => 'markup',
      'label' => 'Documentation & Updates',
      'icon' => 'life-ring',
      'value' => "<p>Hey there, coding rockstars! 👋</p>
        <ul>
          <li><a href=https://www.baumrock.com/en/processwire/modules/$name/docs>Read the docs</a> and level up your coding game! 🚀💻😎</li>
          <li><a href=https://github.com/baumrock/$name>Show some love by starring the project</a> and keep us motivated to build more awesome stuff for you! 🌟💻😊</li>
          <li><a href=https://www.baumrock.com/rock-monthly>Sign up now for our monthly newsletter</a> and receive the latest updates and exclusive offers right to your inbox! 🚀💻📫</li>
        </ul>",
    ]);

Thx a lot!

BernhardBaumrock avatar Feb 03 '24 13:02 BernhardBaumrock

@BernhardBaumrock @jmartsch I pushed an update to this. If you use ModuleName.README.md then it'll display automatically above the module configuration Inputfields. Having the module name in it was good I thought because many packages include multiple modules in the same directory, for instance ProCache and ProcessProCache, and I'd want to be able to show different info for reach one. Some other updates here too, like support for the auto-replacing tags Bernhard mentioned. See the commit notes for details.

ryancramerdesign avatar Feb 06 '24 17:02 ryancramerdesign

Super cool, thank you! :)

BernhardBaumrock avatar Feb 06 '24 17:02 BernhardBaumrock