-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Co-authored-by: Edouard Choinière <[email protected]>
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 <[email protected]>
Co-authored-by: Vaclav Petras <[email protected]>
@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. |
The initial commit simply uncoments the Markdown compilation lines from OSGeo#3849. This requires the actual Markdown files to be present, so this breaks the CI. This will stay like this for now. The PR is mean to be tested together with the Markdown files generated by script in OSGeo#4620 (switch to this branch after generating the files). Subsequent commits will add fixes of the compilation (missing tools, files, etc.).
The initial commit simply uncomments the Markdown compilation lines from #3849. (This requires the actual Markdown files to be present which are now part of the source code.) Subsequent commits add fixes of the compilation (missing tools, files, etc.): * Add compilation of multi-program directories like r.colors, r.mapcalc, and r3.flow * Generate colortable thumbnails. This makes the script little more general and assumes that HTML will be eventually removed (the thumbnails are generated twice now, once for HTML and once of Markdown). * Copy barscale and northarrow files for Markdown doc source. * Presence of spaces vs underscores in key may differ between HTML and Markdown, so always do replacements. * Do not add dash to visible text for keyword. Additionally, remove underscore just like in the HTML version. * Add projectionintro and grass_database pages from doc dir. * Add compilation for GUI, icons, and additional non-Markdown files. * Add basic port of graphical index (removes broken links and provides some content). * Strip keywords from whitespace and skip empty ones The complex r.mapcalc build would fail on the first run attempt presumably because of a raise condition with color table build. This removes it from standard SUBDIR and relies on the extra pre-builld of r.mapcalc dir. However, this fails to do distclean properly and needs to be addressed later. g.extension now creates md from html on the fly if no md is present. The build of Markdown and HTML doc creates a race condition while getting the metadata though git clone, so the build now checks for presence of grass-addons clone and uses the directory as a cache after a successful clone. The code assumes all directory move errors are only the good case of a cache being created in the meantime. The code also creates two (or more) clones if multiple processes run together (git clone runs twice, but the clash in the cache is avoided). --------- Co-authored-by: Anna Petrasova <[email protected]>
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(?)