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: Generate manual from markdown using mkdocs #3849

Merged
merged 153 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 131 commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
a01ab38
very first draft
landam Jun 16, 2024
307432f
re-enable html builds
landam Jun 16, 2024
5aa3564
rename "md" dir to "markdown"
landam Jun 16, 2024
d33bcb9
add converted md file from html using pandoc
landam Jun 16, 2024
e2fd51c
fix various compilation issues
landam Jun 16, 2024
78cbd32
run mkdocs
landam Jun 16, 2024
40b6de9
fix md newline
landam Jun 16, 2024
6d49dae
short commit hash
landam Jun 16, 2024
f0c5311
--md-description: skip main header
landam Jun 16, 2024
f725352
avoid duplicated header for now
landam Jun 16, 2024
bbbeee2
move mkdocs from doc/ to man/
landam Jun 16, 2024
7b7c244
build index file
landam Jun 16, 2024
134ff95
mkdocs: disable directory_urls
landam Jun 17, 2024
3343ae3
lib/init: process md files
landam Jun 17, 2024
f5c4e8b
typo
landam Jun 17, 2024
1f38a1e
implement topic index
landam Jun 17, 2024
93dfcad
implement keyword index
landam Jun 17, 2024
5f3ce2b
enable html keywords index
landam Jun 17, 2024
cd58012
fix grass_logo
landam Jun 17, 2024
f132228
Update man/build_keywords.py
landam Jun 18, 2024
139c5fa
Update man/build_keywords.py
landam Jun 18, 2024
ee88da9
Update man/build_keywords.py
landam Jun 18, 2024
e11b985
Update man/build_keywords.py
landam Jun 18, 2024
71d8df2
Update man/build_keywords.py
landam Jun 18, 2024
6d816e5
Update man/build_keywords.py
landam Jun 18, 2024
58ce945
Update man/build_keywords.py
landam Jun 18, 2024
a72d2ea
Update man/build_keywords.py
landam Jun 18, 2024
adf5af6
change style to material
landam Jun 18, 2024
1b4a3fa
Merge branch 'main' into markdown_docs
landam Jun 18, 2024
13a51fb
implement full_index
landam Jun 18, 2024
0e8e272
logo tuning
landam Jun 18, 2024
97e78ff
fix html keywords
landam Jun 18, 2024
a7c1d33
module md header changed
landam Jun 18, 2024
542ead1
include images
landam Jun 18, 2024
d8ff3de
mkdocs cosmetics
landam Jun 18, 2024
2e34f65
Update man/build_full_index.py
landam Jun 26, 2024
4ecb894
Update man/build_full_index.py
landam Jun 26, 2024
146bb42
Update man/build_full_index.py
landam Jun 26, 2024
2671a0e
Update man/build_full_index.py
landam Jun 26, 2024
2a9a0e5
Update man/build_graphical_index.py
landam Jun 26, 2024
5adea99
Update man/build_graphical_index.py
landam Jun 26, 2024
3b1c8cd
Merge branch 'main' into markdown_docs
landam Jun 26, 2024
cff3253
Update man/build_keywords.py
landam Jun 26, 2024
60fa3b1
Update man/build_graphical_index.py
landam Jun 26, 2024
580fcef
Update man/build_full_index.py
landam Jun 26, 2024
1c9556b
Merge branch 'main' into markdown_docs
landam Aug 8, 2024
08a966c
merge 28bbce8dd772f48d38ef02743ba239207c950c57 + flake8
landam Aug 8, 2024
eef0b70
code block fix in md files
landam Aug 8, 2024
119a0bc
md requiremensts: add mkdocs-material
landam Aug 9, 2024
6c42777
fix compilation issue in gui/scripts
landam Aug 19, 2024
5ab2d36
Update man/build_md.py
landam Aug 19, 2024
d48461b
Update man/build_topics.py
landam Aug 19, 2024
2d78ccf
Update utils/mkmarkdown.py
landam Aug 19, 2024
52d356d
Update utils/mkmarkdown.py
landam Aug 19, 2024
816a49c
Update utils/mkmarkdown.py
landam Aug 19, 2024
40dbcb0
Update utils/mkmarkdown.py
landam Aug 19, 2024
753fab7
Update utils/mkmarkdown.py
landam Aug 19, 2024
84c55e6
Update utils/mkmarkdown.py
landam Aug 19, 2024
e9f31cb
Update man/build_md.py
landam Aug 19, 2024
44736a5
Update man/build_keywords.py
landam Aug 19, 2024
b36d707
Merge branch 'main' into markdown_docs
landam Aug 19, 2024
4ec91d5
fix compilation issue in 'man' dir
landam Aug 19, 2024
e71d72b
fix compilation issue in 'raster' dir
landam Aug 19, 2024
96c5b53
simplify mddesc
landam Aug 19, 2024
9460dee
parser: flag's description may be optional
landam Aug 19, 2024
3e3366b
point logo to index.html
landam Aug 20, 2024
f6255d8
mkdocs: customize site_name
landam Aug 20, 2024
e14483d
fix module indices
landam Aug 20, 2024
d56baaa
fix keywords
landam Aug 20, 2024
fbc81f0
fix guiscript
landam Aug 20, 2024
722b382
implement manual_gallery
landam Aug 20, 2024
d101d51
implement parser_standard_options
landam Aug 20, 2024
b7486e4
Update man/build_keywords.py
landam Aug 20, 2024
0cc3123
Update man/parser_standard_options.py
landam Aug 20, 2024
78b17f5
fix commit ref
landam Aug 20, 2024
723ee55
replace html meta comments with yaml metadata block
landam Aug 20, 2024
c7633b0
introduce build.py
landam Aug 20, 2024
46ff26a
fix building indices
landam Aug 20, 2024
1a74615
full index: avoid HTML tag in MD
landam Aug 20, 2024
7fcf163
simplify title
landam Aug 20, 2024
fa20022
Update man/build_topics.py
landam Aug 20, 2024
5458f76
Update man/build_md.py
landam Aug 20, 2024
b58d65b
Update man/build_md.py
landam Aug 20, 2024
2f6ed6d
Update man/build_full_index.py
landam Aug 20, 2024
0b000be
Update man/build_manual_gallery.py
landam Aug 20, 2024
deb7cac
Update man/build_class.py
landam Aug 20, 2024
fab2a0f
Update man/build.py
landam Aug 20, 2024
a6e625b
Update lib/gis/parser_rest_md.c
landam Aug 20, 2024
77d9f42
Merge branch 'main' into markdown_docs
landam Aug 20, 2024
3f05ec9
extend footer
landam Aug 20, 2024
50edf87
REQUIREMENTS.md: add pip install mkdocs mkdocs-material
neteler Aug 21, 2024
9ebb183
beautify footer
landam Aug 21, 2024
987d992
rename target dir to mkdocs
landam Aug 21, 2024
33a91b9
fix build_class
landam Aug 21, 2024
72dec30
add missing footer
landam Aug 22, 2024
4daa36b
apply black
landam Aug 22, 2024
d3b31d3
apply ruff suggestions
landam Aug 22, 2024
516386d
fix pathlib import
landam Aug 22, 2024
05cd9af
Update utils/mkmarkdown.py
landam Aug 22, 2024
4428a64
apply ruff
landam Aug 22, 2024
682d266
remove auto-generated md files
landam Sep 19, 2024
64ed659
Merge branch 'main' into markdown_docs
landam Sep 19, 2024
9d129e1
Update man/build_keywords.py
landam Sep 19, 2024
00a8c8f
solve conflicts
landam Sep 30, 2024
33753b1
Merge branch 'main' into markdown_docs
landam Sep 30, 2024
2353681
Merge branch 'main' into markdown_docs
landam Oct 6, 2024
1869b31
remove two overlooked MD files
landam Oct 6, 2024
c1581cb
manual merge from master
landam Oct 6, 2024
37c0c15
Update utils/mkmarkdown.py
landam Oct 6, 2024
8aa433b
Update man/build_md.py
landam Oct 6, 2024
6743f1a
fix PR compilation
landam Oct 6, 2024
77f50d3
remove print statements
landam Oct 6, 2024
9429ca7
disable build-mkdocs
landam Oct 6, 2024
7f3497d
Merge branch 'main' into markdown_docs
landam Oct 7, 2024
42a0c0d
npx prettier --print-width 80 -w man/mkdocs/mkdocs.yml
neteler Oct 9, 2024
25eb9a6
os.getcwd() -> Path.cwd()
neteler Oct 9, 2024
28f979a
libgis: module -> name in metadata
landam Oct 14, 2024
3daffab
apply ruff suggestions
landam Oct 14, 2024
3cd862f
apply ruff suggestions
landam Oct 14, 2024
6661c11
apply black
landam Oct 14, 2024
7e2a437
fix flake8 errors
landam Oct 17, 2024
c6a0a74
Merge branch 'main' into markdown_docs
landam Oct 17, 2024
350c8a3
solve multi-line-implicit-string-concatenation (ISC002)
landam Oct 18, 2024
fb75c27
Merge branch 'main' into markdown_docs
landam Oct 18, 2024
839892a
apply black
landam Oct 18, 2024
b486d2a
Merge branch 'main' into markdown_docs
landam Oct 21, 2024
767fe03
merge 870343f
landam Oct 21, 2024
c66cda8
seperate common part in mkhtml/mkmarkdown to mkdocs
landam Oct 24, 2024
f6ab247
apply black
landam Oct 24, 2024
54edbce
comment md-related parts in makefile
landam Oct 24, 2024
9e08f1b
Merge branch 'main' into markdown_docs
landam Oct 24, 2024
66fb33b
Update utils/mkmarkdown.py
landam Oct 24, 2024
00ade4d
Update utils/mkmarkdown.py
landam Oct 24, 2024
2a7434e
apply ruff suggestions
landam Oct 24, 2024
308556e
fix flake8 issues
landam Oct 24, 2024
dea8261
fix mkmarkdown
landam Oct 26, 2024
a43993a
cleanup mkmarkdown
landam Oct 26, 2024
f1379f3
cleanup mkhtml
landam Oct 26, 2024
2e5454c
fix import
landam Oct 26, 2024
1a77853
Merge branch 'main' into markdown_docs
landam Oct 26, 2024
2918609
remove commented blocks
landam Oct 26, 2024
e849291
remove todo comment
landam Oct 26, 2024
974d7f2
fix mkhtml.py: calling get_addon_path()
landam Oct 26, 2024
ac5e963
remove leftover HTML code in MD part
neteler Oct 26, 2024
a1fc15e
remove leftover HTML code in MD part
neteler Oct 26, 2024
c2bdf4d
fix keywords (HTML version)
landam Nov 4, 2024
3dec812
Merge branch 'main' into markdown_docs
echoix Nov 5, 2024
92898df
micro white space fix
neteler Nov 7, 2024
d45c0b6
add pyyaml-env-tag to man/mkdocs/requirements.txt
landam Nov 10, 2024
11011e2
Update man/mkdocs/requirements.txt
landam Nov 10, 2024
ad6170a
remove duplicated pyyaml-env-tag from man/mkdocs/requirements.txt
landam Nov 10, 2024
9be5d69
Update REQUIREMENTS.md
landam Nov 10, 2024
f59b0db
Merge branch 'main' into markdown_docs
landam Nov 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ per-file-ignores =
# E741 ambiguous variable name 'l'
__init__.py: F403
man/build_html.py: E501
man/build_md.py: E501
doc/python/m.distance.py: E501
gui/scripts/d.wms.py: E501
gui/wxpython/image2target/g.gui.image2target.py: E501
Expand Down
2 changes: 2 additions & 0 deletions REQUIREMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ for other platforms you may have to install some of them.
GDAL: [https://gdal.org](https://gdal.org)
- **Python >= 3.8** (for temporal framework, scripts, wxGUI, and ctypes interface)
[https://www.python.org](https://www.python.org)
- **MkDocs** with "Material" theme Python packages for the manual pages:
`pip install mkdocs mkdocs-material`
landam marked this conversation as resolved.
Show resolved Hide resolved

## Optional packages

Expand Down
2 changes: 1 addition & 1 deletion gui/scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MODULE_TOPDIR = ../..

include $(MODULE_TOPDIR)/include/Make/Rules.make
include $(MODULE_TOPDIR)/include/Make/Vars.make
include $(MODULE_TOPDIR)/include/Make/Rules.make
include $(MODULE_TOPDIR)/include/Make/Python.make

DSTDIR = $(GUIDIR)/scripts
Expand Down
1 change: 1 addition & 0 deletions include/Make/Grass.make
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ DOCSDIR = $(ARCH_DISTDIR)/docs
ETC = $(ARCH_DISTDIR)/etc
GUIDIR = $(ARCH_DISTDIR)/gui
HTMLDIR = $(ARCH_DISTDIR)/docs/html
MDDIR = $(ARCH_DISTDIR)/docs/mkdocs
SCRIPTDIR = $(ARCH_DISTDIR)/scripts
MSG_DIR = $(ARCH_DISTDIR)/etc/msgs
MO_DIR = $(ARCH_DISTDIR)/locale
Expand Down
20 changes: 19 additions & 1 deletion include/Make/GuiScript.make
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ include $(MODULE_TOPDIR)/include/Make/ScriptRules.make
include $(MODULE_TOPDIR)/include/Make/HtmlRules.make

MODULES := $(patsubst g.gui.%.py,%,$(wildcard g.gui.*.py))
### to be removed
CMDHTML := $(patsubst %,$(HTMLDIR)/g.gui.%.html,$(MODULES))
GUIHTML := $(patsubst %,$(HTMLDIR)/wxGUI.%.html,$(MODULES))
###
CMDMAN := $(patsubst %,$(MDDIR)/source/g.gui.%.md,$(MODULES))
GUIMAN := $(patsubst %,$(MDDIR)/source/wxGUI.%.md,$(MODULES))
landam marked this conversation as resolved.
Show resolved Hide resolved
ifdef MINGW
SCRIPTEXT = .py
BATFILES := $(patsubst %,$(BIN)/g.gui.%.bat,$(MODULES))
Expand All @@ -19,26 +23,40 @@ BATFILES =
endif
PYFILES := $(patsubst %,$(SCRIPTDIR)/g.gui.%$(SCRIPTEXT),$(MODULES))

guiscript: $(IMGDST) $(PYFILES) $(BATFILES)
guiscript: $(IMGDST) $(IMGDST_MD) $(PYFILES) $(BATFILES)
# we cannot use cross-compiled g.parser for generating html files
ifndef CROSS_COMPILING
$(MAKE) $(CMDHTML)
-rm -f g.gui.*.tmp.html
$(MAKE) $(GUIHTML)
# $(MAKE) $(CMDMAN)
# $(MAKE) $(GUIMAN)
endif

$(HTMLDIR)/g.gui.%.html: g.gui.%.html g.gui.%.tmp.html | $(HTMLDIR)
VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) MODULE_TOPDIR=$(MODULE_TOPDIR) \
$(PYTHON) $(GISBASE)/utils/mkhtml.py g.gui.$* $(GRASS_VERSION_DATE) > $@

$(MDDIR)/source/g.gui.%.md: g.gui.%.md g.gui.%.tmp.md | $(MDDIR)
VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) MODULE_TOPDIR=$(MODULE_TOPDIR) \
$(PYTHON) $(GISBASE)/utils/mkmarkdown.py g.gui.$* $(GRASS_VERSION_DATE) > $@

$(HTMLDIR)/wxGUI.%.html: g.gui.%.html | $(HTMLDIR)
-rm -f g.gui.$*.tmp.html
VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) MODULE_TOPDIR=$(MODULE_TOPDIR) \
$(PYTHON) $(GISBASE)/utils/mkhtml.py g.gui.$* $(GRASS_VERSION_DATE) > $@

$(MDDIR)/source/wxGUI.%.md: g.gui.%.md | $(MDDIR)
-rm -f g.gui.$*.tmp.md
VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) MODULE_TOPDIR=$(MODULE_TOPDIR) \
$(PYTHON) $(GISBASE)/utils/mkmarkdown.py g.gui.$* $(GRASS_VERSION_DATE) > $@

g.gui.%.tmp.html: $(SCRIPTDIR)/g.gui.%
$(call htmldesc,$<,$@)

g.gui.%.tmp.md: $(SCRIPTDIR)/g.gui.%
$(call mddesc,$<,$@)

$(SCRIPTDIR)/g.gui.%$(SCRIPTEXT): g.gui.%.py | $(SCRIPTDIR)
$(INSTALL) $< $@

Expand Down
13 changes: 11 additions & 2 deletions include/Make/Html.make
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,32 @@

include $(MODULE_TOPDIR)/include/Make/HtmlRules.make

$(HTMLDIR)/%.html: %.html %.tmp.html $(HTMLSRC) $(IMGDST) | $(HTMLDIR)
$(HTMLDIR)/%.html: %.html %.tmp.html $(HTMLSRC) $(IMGDST) | $(HTMLDIR)
neteler marked this conversation as resolved.
Show resolved Hide resolved
VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) MODULE_TOPDIR=$(MODULE_TOPDIR) \
$(PYTHON) $(GISBASE)/utils/mkhtml.py $* > $@

# TODO: mode to Markdown.make (?)
$(MDDIR)/source/%.md: %.md %.tmp.md $(HTMLSRC) $(IMGDST_MD) | $(MDDIR)
VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) MODULE_TOPDIR=$(MODULE_TOPDIR) \
$(PYTHON) $(GISBASE)/utils/mkmarkdown.py $* > $@

$(MANDIR)/%.$(MANSECT): $(HTMLDIR)/%.html
$(HTML2MAN) "$<" "$@"

%.tmp.html: $(HTMLSRC)
if [ "$(HTMLSRC)" != "" ] ; then $(call htmldesc,$<,$@) ; fi

# TODO: mode to Markdown.make (?)
%.tmp.md: $(HTMLSRC)
if [ "$(HTMLSRC)" != "" ] ; then $(call mddesc,$<,$@) ; fi

ifdef CROSS_COMPILING

html:

else

html: $(HTMLDIR)/$(PGM).html $(MANDIR)/$(PGM).$(MANSECT)
html: $(HTMLDIR)/$(PGM).html $(MANDIR)/$(PGM).$(MANSECT) # $(MDDIR)/source/$(PGM).md
landam marked this conversation as resolved.
Show resolved Hide resolved

endif

Expand Down
17 changes: 17 additions & 0 deletions include/Make/HtmlRules.make
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@

htmldesc = $(call run_grass,$(1) --html-description < /dev/null | grep -v '</body>\|</html>\|</div> <!-- end container -->' > $(2))

# TODO: mode to MarkdownRules.make (?)
mddesc = $(call run_grass,$(1) --md-description < /dev/null > $(2))

IMGSRC := $(wildcard *.png) $(wildcard *.jpg) $(wildcard *.gif)
IMGDST := $(patsubst %,$(HTMLDIR)/%,$(IMGSRC))
IMGDST_MD := $(patsubst %,$(MDDIR)/source/%,$(IMGSRC))

ifneq ($(strip $(IMGDST)),)
.SECONDARY: $(IMGDST)
endif

ifneq ($(strip $(IMGDST_MD)),)
.SECONDARY: $(IMGDST_MD)
endif

$(HTMLDIR)/%.png: %.png | $(HTMLDIR)
$(INSTALL_DATA) $< $@

Expand All @@ -18,3 +26,12 @@ $(HTMLDIR)/%.jpg: %.jpg | $(HTMLDIR)

$(HTMLDIR)/%.gif: %.gif | $(HTMLDIR)
$(INSTALL_DATA) $< $@

$(MDDIR)/source/%.png: %.png | $(MDDIR)
$(INSTALL_DATA) $< $@

$(MDDIR)/source/%.jpg: %.jpg | $(MDDIR)
$(INSTALL_DATA) $< $@

$(MDDIR)/source/%.gif: %.gif | $(MDDIR)
$(INSTALL_DATA) $< $@
4 changes: 4 additions & 0 deletions include/Make/NoHtml.make
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
$(HTMLDIR)/$(PGM).html:
@echo no HTML documentation available

# TODO: move ?
$(MDDIR)/source/$(PGM).md:
@echo no Markdown documentation available

$(MANDIR)/$(PGM).$(MANSECT):
@echo no manual page available
2 changes: 1 addition & 1 deletion include/Make/Rules.make
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ first: pre default
ARCH_DIRS = $(ARCH_DISTDIR) $(ARCH_BINDIR) $(ARCH_INCDIR) $(ARCH_LIBDIR) \
$(BIN) $(ETC) \
$(DRIVERDIR) $(DBDRIVERDIR) $(FONTDIR) $(DOCSDIR) $(HTMLDIR) \
$(MANBASEDIR) $(MANDIR) $(UTILSDIR)
$(MDDIR) $(MDDIR)/source $(MANBASEDIR) $(MANDIR) $(UTILSDIR)

pre: | $(ARCH_DIRS)

Expand Down
70 changes: 45 additions & 25 deletions lib/gis/parser_rest_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\brief GIS Library - Argument parsing functions (reStructuredText and
Markdown output)

(C) 2012-2023 by the GRASS Development Team
(C) 2012-2024 by the GRASS Development Team

This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
Expand All @@ -20,6 +20,8 @@

#include "parser_local_proto.h"

#define MD_NEWLINE " "

static void usage_rest_md(bool rest);
static void print_flag(const char *key, const char *label,
const char *description, bool rest);
Expand All @@ -41,7 +43,7 @@ void usage_rest_md(bool rest)
struct Option *opt;
struct Flag *flag;
const char *type;
char *header = NULL;
/* char *header = NULL; */
int new_prompt = 0;

new_prompt = G__uses_new_gisprompt();
Expand All @@ -51,7 +53,15 @@ void usage_rest_md(bool rest)
if (!st->pgm_name)
st->pgm_name = "??";

/* main header */
/* print metadata used by man/build*.py */
fprintf(stdout, "---\n");
fprintf(stdout, "name: %s\n", st->pgm_name);
fprintf(stdout, "description: %s\n", st->module_info.description);
landam marked this conversation as resolved.
Show resolved Hide resolved
fprintf(stdout, "keywords: ");
G__print_keywords(stdout, NULL, FALSE);
fprintf(stdout, "\n---\n\n");

/* main header
G_asprintf(&header, "%s - GRASS GIS manual", st->pgm_name);
if (rest) {
size_t s;
Expand All @@ -65,8 +75,9 @@ void usage_rest_md(bool rest)
fprintf(stdout, "# %s\n", header);
}
fprintf(stdout, "\n");
*/

/* GRASS GIS logo */
/* GRASS GIS logo
if (rest) {
fprintf(stdout, ".. image:: grass_logo.png\n");
fprintf(stdout, " :align: center\n");
Expand All @@ -75,11 +86,18 @@ void usage_rest_md(bool rest)
else {
fprintf(stdout, "![GRASS logo](./grass_logo.png)\n");
}
/* horizontal line */
*/

/* main header */
if (!rest)
fprintf(stdout, "# %s\n\n", st->pgm_name);

/* horizontal line
fprintf(stdout, "\n---");
if (rest)
fprintf(stdout, "-");
fprintf(stdout, "\n\n");
*/

/* header - GRASS module */
if (!rest)
Expand All @@ -88,7 +106,7 @@ void usage_rest_md(bool rest)
if (rest)
fprintf(stdout, "----");
fprintf(stdout, "\n");
fprintf(stdout, "**%s**", st->pgm_name);
fprintf(stdout, "***%s***", st->pgm_name);

if (st->module_info.label || st->module_info.description)
fprintf(stdout, " - ");
Expand Down Expand Up @@ -130,13 +148,13 @@ void usage_rest_md(bool rest)
}
fprintf(stdout, "**%s**", st->pgm_name);
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
if (rest)
fprintf(stdout, "| ");
fprintf(stdout, "**%s --help**", st->pgm_name);
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
if (rest)
fprintf(stdout, "| ");
Expand Down Expand Up @@ -219,7 +237,7 @@ void usage_rest_md(bool rest)
while (st->n_flags && flag != NULL) {
print_flag(&flag->key, flag->label, flag->description, rest);
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
flag = flag->next_flag;
}
Expand All @@ -228,21 +246,21 @@ void usage_rest_md(bool rest)
_("Allow output files to overwrite existing files"),
rest);
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
}
}
print_flag("help", NULL, _("Print usage summary"), rest);
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
print_flag("verbose", NULL, _("Verbose module output"), rest);
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
print_flag("quiet", NULL, _("Quiet module output"), rest);
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
print_flag("ui", NULL, _("Force launching GUI dialog"), rest);
fprintf(stdout, "\n");
Expand All @@ -263,7 +281,7 @@ void usage_rest_md(bool rest)
opt = opt->next_opt;
if (opt != NULL) {
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
}
fprintf(stdout, "\n");
}
Expand All @@ -284,21 +302,23 @@ void print_flag(const char *key, const char *label, const char *description,
fprintf(stdout, "-");
fprintf(stdout, "-%s**", key);
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
if (label != NULL) {
if (rest)
fprintf(stdout, "| ");
print_escaped(stdout, "\t", rest);
print_escaped(stdout, label, rest);
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
}
if (rest)
fprintf(stdout, "| ");
print_escaped(stdout, "\t", rest);
print_escaped(stdout, description, rest);
if (description != NULL) {
if (rest)
fprintf(stdout, "| ");
print_escaped(stdout, "\t", rest);
print_escaped(stdout, description, rest);
}
}

void print_option(const struct Option *opt, bool rest, char *image_spec_rest)
Expand Down Expand Up @@ -341,7 +361,7 @@ void print_option(const struct Option *opt, bool rest, char *image_spec_rest)
fprintf(stdout, " **[required]**");
}
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
if (opt->label) {
if (rest)
Expand All @@ -352,7 +372,7 @@ void print_option(const struct Option *opt, bool rest, char *image_spec_rest)
if (opt->description) {
if (opt->label) {
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
}
if (rest)
Expand All @@ -363,7 +383,7 @@ void print_option(const struct Option *opt, bool rest, char *image_spec_rest)

if (opt->options) {
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
if (rest)
fprintf(stdout, "| ");
Expand All @@ -375,7 +395,7 @@ void print_option(const struct Option *opt, bool rest, char *image_spec_rest)

if (opt->def) {
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
if (rest)
fprintf(stdout, "| ");
Expand All @@ -394,7 +414,7 @@ void print_option(const struct Option *opt, bool rest, char *image_spec_rest)
while (opt->opts[i]) {
if (opt->descs[i]) {
if (!rest)
fprintf(stdout, "\\");
fprintf(stdout, MD_NEWLINE);
fprintf(stdout, "\n");
char *thumbnails = NULL;
if (opt->gisprompt) {
Expand Down
Loading
Loading