Problem/Motivation
Currently, README.md files are not available for each sub-modules. Instead, the documentation is contained within the .module files to facilitate parsing by api.drupal.org.
As a coder who reads source code, I prefer to read the README first. Visiting api.drupal.org is an option, but usually, I was leading to there by search engines. If I have the source code on my local, I read the README.md first.
Meanwhile, we are using GitLab more and more, it parses README.md automatically.
And I read a message on slack recently that api.drupal.org was not working well.
Meanwhile, I am considering using ChatGPT to help and translate the README.md file into other languages. It can lower the barrier more or less for learning from the examples module.
All README.md files will be parsed/rendered automatically on GitLab as well. And each transition should be reviewed by a native before gets committed.
Steps to reproduce
Proposed resolution
- Continue with extracting a README.md from the .module file to avoid credits gaming, do it in one go, or do it with 3-5 submodules per batch.
- Extract a README.md file from the .module file for each submodule -- Chatgpt may help
- Remove those long comment blocks from .module files
- To have an example of help_topics: help_topics_example, #3155111: Add help_topics example, postpone the implementation or integration of help_topics into examples.
- Allow to accept translations of README.md, but optional, for the syncing. If the translation is outdated, give it a time window, e.g. one or two weeks to update, or it gets removed.
Take js_exmaple sub-module as the example, optional translation support with the following file structure:
README.md // English by default
README.translation
- zh-hans/README.md // Chinese,
- es/README.md // Spanish
- fr/README.md // French
...
Or with the following file paths
- js_example/README.md
- js_example/README.translations/zh-hans/README.md
- js_example/README.translations/es/README.md
- js_example/README.translations/fr/README.md
- ...
Fewer lines would be better in code or TLDR.
Comments
Comment #2
jungleComment #3
ressaI agree with your proposed resolution @jungle, moving the documentation out from each sub-module and into a README.md makes a lot of sense.
So, as an example, would it mean deleting this part from the js_example.module:
... remove D8 reference, and add it to a new README.md file, like this?
Comment #4
ressaAdded child issue creation as a task under "Proposed resolution".
Comment #5
jungleI copied and pasted the content of file_example.module file into chatgpt, and asked it to do it for me, it works well to me.
See the commit here
The sample instruction i used, FYI
Comment #6
jungleGo ahead please with the suggestion in #5 if you like, thanks!
Comment #7
jungleMeanwhile, we are using GitLab more and more, it parses README.md automatically. Let's do it.
Comment #8
jungleComment #9
jungleRe #3 yes, for the example of removal, see this commit
Comment #10
jungleMeanwhile, I am considering using ChatGPT to help and translate the README.md file into other languages. It can lower the barrier more or less for learning from the examples module.
The file structure would be
All README.md files will be parsed/rendered automatically on GitLab as well. And each transition should be reviewed by a native before gets committed.
Comment #11
jungleComment #12
jungleComment #13
jungleComment #14
jungleOr replace the folder name
READMEwithREADME_translationsin the suggested file structure.Comment #15
ressaGreat idea with the different languages @jungle!
I found this page: https://gitlab.com/postgres-ai/database-lab/-/blob/master/translations/R... with path
projectname/translations/README.german.md.So maybe a structure like this would work, same as theirs?
Maybe we should start out with creating the sub-theme README.md's from the .module content, since that text has been curated and written by one or more persons, but use ChatGPT for translating, like you suggest? At some point, the texts can be rewritten with the help of ChatGPT, if we decide so.
Also, are you able to create a "Documentation" option under "Component" for issues?
Comment #16
ressaI have created #3344564: Create README.md for Example: JavaScript sub-module (js_example) ready for review.
I used "JavaScript examples" for the header, since in that case, "examples" is used not as a name but a verb, from what I understand, reading https://www.drupal.org/drupalorg/style-guide/content.
Should we add README.md translations for sub-themes such as "JavaScript examples" as child issues under them, to keep it orderly?
Comment #17
jungleAdded
The structure works, but I still think the following is better.
Comment #18
jungleComment #19
jungle@ressa, I did send this issue to #examples-module and #documentaion in Drupal slack, hopefully, We can get agreement or feedback from them, and I would suggest holding on for a day or two, at least, before taking any further contributions. As I am not the only maintainer of this project, others may have different opinions. This is a kind of broken change. -- content of this module on api.drupal.org gets affected.
Many thanks!
Comment #20
ressaThanks for the new "Documentation" Component :)
I prefer to keep paths and names short, and have all files in the same folder for less clicking, which is why I suggest this structure:
examples/translations/README.german.mdThis is also fine:
examples/README-translations/README.german.mdWhat would be the benefits of having the translations in individual folders?
Comment #21
ressaGood idea, let's get some more opinions :)
Comment #22
jungleSuggested file pathes are the above. Or another variation: replace README-translations with README.translations
Comment #23
jungleThe root is each submodule, in my suggestion. E.g.
> What would be the benefits of having the translations in individual folders?
The benefit would be to visit
URL_PREFIX_OMITTED/js_example/README.translations/zh-hans, you will see the Chinese README ofjs_examplemodule, Just like clean URLs, eg, foo/bar/index,html, visit foo/bar, if it's foo/bar.index.html, you have to visit the exact path.Comment #24
ressaAh yes, the README.md would get rendered, true. In that case the number of clicks required to read the content would be the same with these two paths:
Comment #26
jungle> valthebald: for README.md, will this be compatible with core's help_topics module?
> valthebald: it would be great to do so
> valthebald @jungle ^
> jungle: Hi, @valthebald no plan from me for that, to me, personally, it’s optional, README.md is enough for me as a dev. it’s an Experimental module in Drupal 9, I do not think it’s widely adopted by contrib modules, — just guess.
>jungle: even implementing hook_help is optional to me.
Chatting messages from slack.
Comment #27
ressaGreat to see there's discussion going on, thanks for sharing!
Comment #29
jungleThere are more discussions continued with the above on slack, for the full messages in the thread, please view it here,
The summary we agreed on:
Thanks @valthebald and @andypost
Comment #30
jungleUpdating Proposed resolution
Comment #31
jungleComment #32
jungleComment #33
avpadernoSince the plan described here is to remove the documentation comments and replace them with an external file, I would say this is a won't fix. Documentation in code is preferable because it requires editing a single file, instead of two or more files, which makes the process easier and less prone to mistakes.
I am not sure moving the information in Markdown files has any pro using api.drupal.org does not have. api.drupal.org is able to provide a list of classes, methods, functions, and constant that Markdown files are not able to provide.