-
-
Notifications
You must be signed in to change notification settings - Fork 315
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: Generate manual from markdown using mkdocs #3849
Conversation
I was about to approve, but did a quick other check. There's two things that stood out. |
Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com>
I get an error with
After deleting
|
Environmental variables are supported by mkdocs: https://www.mkdocs.org/user-guide/configuration/#environment-variables @wenzeslaus Which version of mkdocs do you have? |
please install requirements: See How To, step 1. |
Probably you have to install https://github.com/waylan/pyyaml-env-tag |
If so, we have to update requirements file accordingly. Let us now. |
I used the requirements file. I have mkdocs 1.1.2. I also added pyyaml-env-tag and reinstalled. I will try to trash everything and start over, but I think I'm still the three mkdocs plugins. |
Thanks. Starting from scratch with the pyyaml-env-tag package helped. The result (for core repo) looks great! |
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.
This creates a great minimal working product (assuming a conversion is done on the side). It does not break the current HTML doc build. while there is a lot of places to improve, we can work on them as PRs against main.
I have only the 2-3 comments about dependencies.
I would be also curious to see a list of special cases you encountered, i.e., what special pages we have. It is sort of hard to keep track. We have the standard options table, intro pages, family, topic and keyword lists, anything else?
Ok, requirements file updated in d45c0b6 |
Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
@neteler No, otherwise the GRASS compilation fails (and breaks CI) since there are no MD files in repo. It can be activated in #4620 or in follow-up PR which adds generated MD files to git. |
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.
Tested on Fedora 40, the result, i.e. the generated manual pages based on markdown look great!
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.
Thanks for addressing the dependencies. I tested the previous version as discussed in my previous review.
It seems that this change was missing in this PR: --- a/lib/gis/parser_rest_md.c
+++ b/lib/gis/parser_rest_md.c
@@ -517,7 +517,7 @@ void print_escaped_for_md_keywords(FILE *f, const char *str)
fputc(*s, f);
}
}
- fprintf(f, ".html)");
+ fprintf(f, ".md)");
}
else { /* first and other than second keyword */
if (st->n_keys > 0 && strcmp(st->module_info.keywords[0], str) == 0) {
@@ -532,13 +532,13 @@ void print_escaped_for_md_keywords(FILE *f, const char *str)
fputc(*s, f);
}
}
- fprintf(f, ".html)");
+ fprintf(f, ".md)");
}
else {
/* keyword index */
char *str_link;
str_link = G_str_replace(str_s, " ", "%20");
- fprintf(f, "[%s](keywords.html#%s)", str_s, str_link);
+ fprintf(f, "[%s](keywords.md#%s)", str_s, str_link);
G_free(str_link);
}
} This fixes [...]
WARNING - Doc file 'd.what.rast.md' contains a link 'display.html', but the target is not found among documentation files. Did you mean 'display.md'?
WARNING - Doc file 'd.what.rast.md' contains a link 'topic_vector.html', but the target is not found among documentation files. Did you mean 'topic_vector.md'?
WARNING - Doc file 'd.what.vect.md' contains a link 'display.html', but the target is not found among documentation files. Did you mean 'display.md'?
WARNING - Doc file 'd.what.vect.md' contains a link 'topic_vector.html', but the target is not found among documentation files. Did you mean 'topic_vector.md'?
WARNING - Doc file 'd.where.md' contains a link 'display.html', but the target is not found among documentation files. Did you mean 'display.md'?
WARNING - Doc file 'd.where.md' contains a link 'topic_sampling.html', but the target is not found among documentation files. Did you mean 'topic_sampling.md'?
[...]
WARNING - Doc file 'g.copy.md' contains a link 'general.html', but the target is not found among documentation files. Did you mean 'general.md'?
WARNING - Doc file 'g.copy.md' contains a link 'topic_map_management.html', but the target is not found among documentation files.
WARNING - Doc file 'g.copy.md' contains a link 'keywords.html#copy', but the target 'keywords.html' is not found among documentation files. Did you mean
'keywords.md#copy'?
WARNING - Doc file 'g.dirseps.md' contains a link 'general.html', but the target is not found among documentation files. Did you mean 'general.md'?
[...] I am not fully sure if this change is correct - it helps to get rid of above error messages but still So I kindly ask @landam and others for support. |
Goal
Build user manual from Markdown using mkdocs
How to test
man/mkdocs/requirements.txt
/tmp/code.lua
:make distclean; ./configure ...; make
)(cd man; make build-mkdocs)
dist.x86_64-pc-linux-gnu/docs/mkdocs/site/index.html
in web browserTasks
Critical:
mkmarkdown.py
man
: integrate changes frommain
separate makefile rules (Markdown.make, MarkdownRules.make) ?gui/script/
compilationraster
man
--md-description
Important:
build_md.py
and indicesmeta page
comments to MD files (as YAML metadata block)g.extension
for the addonssite_name
to "GRASS GIS 8.5.0dev Reference Manual"Nice to have:
man
dir:GISBASE="/home/martin/src/grass/dist.x86_64-pc-linux-gnu" ARCH="x86_64-pc-linux-gnu" ARCH_DISTDIR="/home/martin/src/grass/dist.x86_64-pc-linux-gnu" VERSION_NUMBER=8.5.0dev VERSION_DATE=2024 python3 ./build_manual_gallery.py
) and seedist.x86_64-pc-linux-gnu/docs/markdown/site/manual_gallery.html
and https://grass.osgeo.org/grass84/manuals/manual_gallery.htmlTasks after merge(?)