Skip to content
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

docs: mkdocs edit and view on github #5114

Merged
merged 12 commits into from
Feb 19, 2025
Merged

Conversation

cwhite911
Copy link
Contributor

This PR is a replacement for PR #5104 addressing Issue #5103.

This pull request includes several changes to the man/Makefile and related files to enhance the documentation build process and add new features for editing and viewing on GitHub. The most important changes include adding new scripts and hooks, updating the mkdocs.yml configuration, and modifying HTML templates for custom actions.

Enhancements to the documentation build process:

  • man/Makefile: Added new entries for gh-paths.yml and hook_list_scripts.py, and created a target to list Markdown file contents. [1] [2]

Configuration updates:

  • man/mkdocs/mkdocs.yml: Added repository information, new hooks, and updated the theme to include content actions for editing and viewing on GitHub. [1] [2]

Template modifications:

New script:

  • man/mkdocs/scripts/hook_list_scripts.py: Introduced a new script to read and store tool names from gh-paths.yml into the Mkdocs extra configuration directly into GitHub to view and edit documentation sources.

Know Issue

  • Tools that don't follow the <tool_directory>/<tool_name>/<prefix>.<tool_name>.md convention (raster/r.watershed/r.watershed.md) or are not in /scripts/**/*.md do not work.

@github-actions github-actions bot added Python Related code is in Python HTML Related code is in HTML docs labels Feb 14, 2025
@cwhite911
Copy link
Contributor Author

cwhite911 commented Feb 14, 2025

  • man/Makefile: Added new entries for gh-paths.yml and hook_list_scripts.py, and created a target to list Markdown file contents. [1] [2]

I chose a different approach to get the tool paths by extracting their github url from the generated md files in docs/mkdocs/source using the mkdocs on_config hook and setting the path for the page edit buttons with a custom jinga function. At this point I've have most edge cases sorted out, but I am still working on the gui section and identifying any other unknown unknowns, so any input would be helpful.

I know we could just add our own edit on github button at the bottom of the page like we are currently doing to add the Source Code section..

Available at: r.volume source code (history)
Edit Docs: r.volume docs edit
Latest change: Thursday Feb 13 11:55:34 2025 in commit: ffc0b8c

But I'm trying to embrace the material mkdocs ecosystem by doing it the way it's design.

@cwhite911 cwhite911 marked this pull request as ready for review February 14, 2025 20:56
@cwhite911 cwhite911 self-assigned this Feb 14, 2025
@cwhite911
Copy link
Contributor Author

@landam do you know a better way to do this?

@cwhite911
Copy link
Contributor Author

This is ready for review.

Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great!

@petrasovaa petrasovaa merged commit c1da5fd into OSGeo:main Feb 19, 2025
26 checks passed
@github-actions github-actions bot added this to the 8.5.0 milestone Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs HTML Related code is in HTML Python Related code is in Python
Projects
Development

Successfully merging this pull request may close these issues.

4 participants