-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependency on m2r (use MyST instead) #6
Conversation
No need for additional dependencies here, the License is anyway expected to be plain text.
NOTE: This breaks support for READMEs in rst format!
When using MyST to include Markdown-READMEs a different include command is needed in case of a README in rst format. Therefore move the code for searching and copying the README into a function and construct the include command there, depending on the format of the file. This is then added to the index.rst using a template variable. Move the equivalent code for the license file to its own function in the same way, to be consistent.
It is not used anymore.
@MaximilienNaveau Sorry, I forgot to add you as reviewer... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work!
Thanks!
def _copy_readme(source_dir: Path, destination_dir: Path) -> str: | ||
"""Searches for a README in the source and copies it to the destination directory . | ||
|
||
Searches for a "README.md" or "README.rst" (case-insensitive) in the source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also look for "README" and assume markdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense but I think it will need a bit of rewrite. I'll create an issue to add this in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
We can use MyST to include the README.md into a rst file, thus getting rid of the dependency on m2r (which provides
mdinclude
that was used before).As this makes different include commands necessary, depending on the format of the README ("md" or "rst"), move the code for handling the README to its own function and generate the appropriate include directive there. This is then added to index.rst using a template variable.
Apply equivalent changes for including the license file. Since the license is always expected to be plain text, no format distinction is needed here. Simply using standard
.. include::
instead of.. mdinclude::
results in the same output, at least for our BSD license files.Note that there is a minor difference to using m2r, the section headers of the included README are one level lower now (left is with m2r, right with MyST):
However, I don't think this is a problem. Apart from this the result looks exactly the same.
Closes #2.
How I Tested
By building the documentation for blmc_drivers (which has a README.md) and robot_fingers (which has README.rst).
I fulfilled the following requirements