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

Draft
wants to merge 105 commits into
base: main
Choose a base branch
from

Conversation

landam
Copy link
Member

@landam landam commented Jun 16, 2024

Goal

Build user manual from Markdown using mkdocs

image

How to test

  1. Install requirements, see man/mkdocs/requirements.txt
  2. Create file /tmp/code.lua:
function CodeBlock (cb)
    return pandoc.RawBlock('markdown', '```\n' .. cb.text .. '\n```\n')
end
  1. Convert HTML files to Markdown:
for f in `find . -name *.html`; do echo $f; cat $f | sed 's#<div class="code"><pre>#<pre><code>#g' | sed 's#</pre></div>#</code></pre>#g' | pandoc --from=html --to=markdown --lua-filter /tmp/code.lua > ${f%%.html}.md;done
  1. Compile GRASS
  2. Open dist.x86_64-pc-linux-gnu/docs/mkdocs/site/index.html in web browser

Tasks

Critical:

  • fix CI
  • man : integrate changes from main
  • separate makefile rules (Markdown.make, MarkdownRules.make) ?
  • make install
  • fix gui/script/ compilation
  • fix compilation issue in raster
  • fix compilation issue in man
  • fix segfault in --md-description
  • fix code blocks
  • fix commit link

Important:

  • implement build_md.py and indices
  • solve warnings generated by mkdocs
  • add missing meta page comments to MD files (as YAML metadata block)
  • consider to keep supporting HTML in g.extension for the addons
  • parser_standard_options: choose formatting than table
  • index: choose better formatting than table
  • replace html with md in links
  • remove toc-related code from mkmarkdown.py and change mkdocs style to show page-related TOC
  • fix "## DESCRIPTION" appearance from keyword list
  • logo points to index.html
  • site_name to "GRASS GIS 8.5.0dev Reference Manual"
  • fix menu items
  • implement parser_standard_options
  • implement manual_gallery
  • use theme footer

Nice to have:

Tasks before merge

  • rebase main and regenerate MD files from HTML once again

Tasks after merge(?)

  • remove rest-related scripts
  • generate man from markdown
  • remove HTML-based documentation and clean-up scripts

@landam landam marked this pull request as draft June 16, 2024 13:28
@landam landam self-assigned this Jun 16, 2024
@landam landam added the docs label Jun 16, 2024
@landam landam added this to the 8.5.0 milestone Jun 16, 2024
@github-actions github-actions bot added windows Microsoft Windows specific GUI wxGUI related vector Related to vector data processing raster Related to raster data processing temporal Related to temporal data processing Python Related code is in Python database Related to database management libraries module general display imagery tests Related to Test Suite raster3d misc labels Jun 16, 2024
landam and others added 6 commits August 20, 2024 20:28
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
lib/gis/parser_rest_md.c Outdated Show resolved Hide resolved
@landam landam changed the title docs: Generate manual from markdown docs: Generate manual from markdown using mkdocs Aug 21, 2024
@github-actions github-actions bot added the HTML Related code is in HTML label Aug 22, 2024
landam and others added 5 commits August 22, 2024 08:17
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
man/build_keywords.py Outdated Show resolved Hide resolved
@neteler
Copy link
Member

neteler commented Sep 13, 2024

Hi @landam! After discussion with @wenzeslaus, we would like to propose to remove the auto-converted MD manual pages from this PR to reduce its size.

Once the software part of this PR is working

  • we can create a new PR to add the auto-converted MD manual pages
  • then compare them to the original HTML pages and update/fix these MD files if necessary
  • and finally remove the HTML pages in another PR.

This way it is easier to handle/review and less work in this PR. What do you think?

@landam
Copy link
Member Author

landam commented Sep 19, 2024

Hi @landam! After discussion with @wenzeslaus, we would like to propose to remove the auto-converted MD manual pages from this PR to reduce its size.
This way it is easier to handle/review and less work in this PR. What do you think?

@neteler Make sense to me, done in 682d266

landam and others added 4 commits September 19, 2024 16:44
@@ -9,79 +9,101 @@
import sys
import os

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change
import operator

prefix = cmd.split(".")[0]
if prefix not in [item[0] for item in classes]:
classes.append((prefix, class_labels.get(prefix, prefix)))
classes.sort(key=lambda tup: tup[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change
classes.sort(key=lambda tup: tup[0])
classes.sort(key=operator.itemgetter(0))

get_desc,
)

build_full_index("md")
Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change
build_full_index("md")
build_full_index("md")

for k in sorted(char_list.keys()):
test_length += 1
# toc += '<li><a href="#%s" class="toc">%s</a></li>' % (char_list[k], k)
if test_length % 4 == 0 and not test_length == all_keys:
Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change
if test_length % 4 == 0 and not test_length == all_keys:
if test_length % 4 == 0 and test_length != all_keys:

"""
try:
response = urlopen(url, *args, **kwargs)
if not response.code == 200:
Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change
if not response.code == 200:
if response.code != 200:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C CSS Related code is in CSS database Related to database management display docs general GUI wxGUI related HTML Related code is in HTML imagery libraries misc module Python Related code is in Python raster Related to raster data processing raster3d temporal Related to temporal data processing tests Related to Test Suite vector Related to vector data processing windows Microsoft Windows specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants