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

[Feat] Integrate grass-addons into mkdocs doc #5158

Open
5 of 9 tasks
wenzeslaus opened this issue Feb 20, 2025 · 8 comments
Open
5 of 9 tasks

[Feat] Integrate grass-addons into mkdocs doc #5158

wenzeslaus opened this issue Feb 20, 2025 · 8 comments
Labels
enhancement New feature or request

Comments

@wenzeslaus
Copy link
Member

wenzeslaus commented Feb 20, 2025

What is needed to make it on par with the current HTML doc:

Optional tasks:

  • Edit on GitHub works also for addons.

How to get it

CI

Grab mkdocs site artifact from main, related PR, or the Action tab / Documentation.

Locally

Assumes you have core repo in grass and addons repo in grass-addons.

Assumes you are in environment with mkdocs.

Compile and install:

cd grass
.github/workflows/build_ubuntu-22.04.sh "$HOME/install"

Get the get version numbers:

eval $(./utils/update_version.py status --bash)
cd ..

Set path to compiled binary:

export PATH="$HOME/install/bin":$PATH

Compile addons:

./grass-addons/utils/cronjobs_osgeo_lxd/compile_addons_git.sh "$MAJOR" "$MINOR" $(pwd)/grass-addons/src $(grass --config path) $(pwd)/addons-build-dir grass

Path to where the addons doc should be:

MKDOCS_DIR="$(grass --config path)/docs/mkdocs"

Copy the relevant part of compiled doc:

mkdir -p "$MKDOCS_DIR/source/addons"
mv addons-build-dir/docs/md/source/* "$MKDOCS_DIR/source/addons"

Rebuild keywords:

export ARCH="linux"
export ARCH_DISTDIR="$(grass --config path)"
export VERSION_NUMBER="$VERSION"
grass --tmp-project XY --exec python grass/man/build_keywords.py "$MKDOCS_DIR/source" "$MKDOCS_DIR/source/addons"
export SITE_NAME="GRASS GIS $VERSION Reference Manual"
export COPYRIGHT="© 2003-$YEAR GRASS Development Team, GRASS GIS $VERSION Reference Manual"
cd "$MKDOCS_DIR"
mkdocs build

The workflow is similar to the CI code from #5152.

@wenzeslaus
Copy link
Member Author

What is not clear to me here is how keywords should handled. I have to do local changes to the keywords script to make it work, i.e., have keywords from addons in the keyword index. Then, I still need to fix links in the addons dir to point to the parent directory. I can't find that code anywhere.

@neteler
Copy link
Member

neteler commented Feb 21, 2025

Probably @tmszi knows more about the keywords magic?

@wenzeslaus
Copy link
Member Author

I think I found it. The missing piece of puzzle for me was HTML_PAGE_FOOTER_PAGES_PATH.

@wenzeslaus
Copy link
Member Author

Current state on main

Keywords

Keywords generally work in both directions.

Image

Image

There are some anchor naming issues (mkdocs drops special characters from anchor while our custom tooling for HTML preserved them):

INFO    -  Doc file 'addons/g.proj.identify.md' contains a link '../keywords.md#.prj', but the doc 'keywords.md' does not contain an anchor '#.prj'.
INFO    -  Doc file 'addons/r.mcda.input.md' contains a link '../keywords.md#multi-criteria-decision-analysis-(mcda)', but the doc 'keywords.md' does not contain an anchor '#multi-criteria-decision-analysis-(mcda)'.
INFO    -  Doc file 'addons/r.mcda.output.md' contains a link '../keywords.md#multi-criteria-decision-analysis-(mcda)', but the doc 'keywords.md' does not contain an anchor '#multi-criteria-decision-analysis-(mcda)'.
INFO    -  Doc file 'addons/r.stream.stats.md' contains a link '../keywords.md#horton's-statistics', but the doc 'keywords.md' does not contain an anchor '#horton's-statistics'.

Additionally, there is a number of broken links reported by mkdocs which are mostly also in the HTML doc (passing silently) related to non-existent topics, addon tools, missing files, core tools. However, there is couple of issues which definitely look new, for example:

WARNING -  Doc file 'addons/r.futures.parallelpga.md' contains a link 'r.futures.devpressure.md', but the target 'addons/r.futures.devpressure.md' is not found among documentation files.
WARNING -  Doc file 'addons/r.futures.parallelpga.md' contains a link 'r.futures.demand.md', but the target 'addons/r.futures.demand.md' is not found among documentation files.
WARNING -  Doc file 'addons/r.futures.parallelpga.md' contains a link 'r.futures.calib.md', but the target 'addons/r.futures.calib.md' is not found among documentation files.

Source code links

Source code and history links work.

The commit does not, Here it is a link which always goes to grass repo, never to grass-addons, and it is always the latest repo commit, not the specific dir commit, even for the core tools (so issue not necessarily related to addons). This might be more the CI setup issue, than the Markdown vs HTML issue (or both).

Image

Edit button

Works for core tools, but not for addons.

Footer

Links in footer of addon tools go to addons dir, not to to ../.

Image

@echoix
Copy link
Member

echoix commented Feb 25, 2025

I have a general opinion on addons docs built in the main repo.

I'm not sure if it won't be causing us more problems by coupling our high activity repo, with the low activity grass-addons.

Repeatedly building addons in the main repo seems like a waste to me.

In the best of worlds, a solution where each of the repos could be independent, and each could build the docs and upload them and still being usable on the web (not too separated, still integrated together) would be ideal.

@neteler
Copy link
Member

neteler commented Feb 25, 2025

In the best of worlds, a solution where each of the repos could be independent, and each could build the docs and upload them and still being usable on the web (not too separated, still integrated together) would be ideal.

In this case, the integration of the addons into the keyword index, full index and other overview pages would no longer be possible. That was actually a great achievement, done esp. by @tmszi. This said: it used to happen on the server, once a day. Doing everything in GHA changes the situation. So we need to find the best of the two worlds...

@echoix
Copy link
Member

echoix commented Feb 25, 2025

I understand things might not be possible, I didn't evaluate the feasibility, that's why I didn't object myself really hard in that effort. It's only a dream.

@wenzeslaus
Copy link
Member Author

I'm open to suggestions. I just don't have a better idea at this point.

Not completely wasted though, it is good to check that addons compile after change on main, but that's of course not a deep test. The documentation also goes online for both and is influenced by combination of both. Most changes won't matter, but that's the case always.

What I don't like is actually the possibility to break main with addons change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

No branches or pull requests

3 participants