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

doc: Add Markdown files #1329

Merged
merged 2 commits into from
Feb 19, 2025
Merged

doc: Add Markdown files #1329

merged 2 commits into from
Feb 19, 2025

Conversation

wenzeslaus
Copy link
Member

@wenzeslaus wenzeslaus commented Feb 19, 2025

This is equivalent of OSGeo/grass#5057

This needs to be rebase merged without squash as two commits:

  • doc: Rename .html to .md
  • doc: Add .html files back

(The actual full commit messages will go to the base branch this time.)

Workflow

Set up a local repo for contributing:

git clone [email protected]:OSGeo/grass-addons.git
cd grass-addons
pre-commit install
# setup upstream and fork as needed

Get list of all HTML files:

git ls-files | grep -E ".html$" > ../all_addon_html_files.txt

Rename .html to .md:

while read -r FILE; do git mv $FILE $(echo $FILE | sed -e 's+.html$+.md+g'); done < ../all_addon_html_files.txt

Commit, but skip pre-commit with --no-verify (no fixes here, just pure rename):

git commit --no-verify -m "doc: Rename .html to .md

This is the first step in conversion of files with HTML documentation to Markdown.
It makes Git keep the history, esp. blame, for the Markdown file.

It does not touch r.landscape.evol which already has documentation in Markdown.
"

Repeat the four following steps as needed until pre-commit passes with no fixes or complains:

pre-commit run -a
git restore .
# edit .markdownlint.yml (in your favorite editor)
git add -p

Now amend the original commit, but this time let pre-commit verify the changes:

git commit --amend -m "doc: Rename .html to .md

This is the first step in conversion of files with HTML documentation to Markdown.
It makes Git keep the history, esp. blame, for the Markdown file.

It does not touch r.landscape.evol which already has documentation in Markdown.
"

Get the .html back:

while read -r FILE; do cp $(echo $FILE | sed -e 's+.html$+.md+g') $FILE; git add $FILE; done < ../all_addon_html_files.txt

Our list contains r.landscape.evol, but that already has a Markdown file, so we won't be destroying its HTML file either:

git restore --staged src/raster/r.landscape.evol/r.landscape.evol.html
git restore src/raster/r.landscape.evol/r.landscape.evol.html

Commit the .html files:

git commit -m "doc: Add .html files back

HTML will be in place as long as needed, but the primary, canonical file is the Markdown file.

It does not touch r.landscape.evol which already has documentation in Markdown.
"

Push.

To merge, I will enable the Rebase and merge option and merge with that.

Disable the Allow rebase merging option.

This is the first step in conversion of files with HTML documentation to Markdown.
It makes Git keep the history, esp. blame, for the Markdown file.

It does not touch r.landscape.evol which already has documentation in Markdown.
HTML will be in place as long as needed, but the primary, canonical file is the Markdown file.

It does not touch r.landscape.evol which already has documentation in Markdown.
@wenzeslaus wenzeslaus changed the title add md files doc: Add Markdown files Feb 19, 2025
@echoix
Copy link
Member

echoix commented Feb 19, 2025

I assume the older grass8 will work correctly as it has access to html files too.

When it comes time to update addons docs, which are the source of truth? What is the guidance to update the HTML if a markdown is updated?

@wenzeslaus
Copy link
Member Author

I assume the older grass8 will work correctly as it has access to html files too.

Yes, I assume that too :-) I'm reasonably sure actually.

When it comes time to update addons docs, which are the source of truth?

Markdown is the source of truth, i.e., it should be always updated.

What is the guidance to update the HTML if a markdown is updated?

HTML can be updated if the contributor wants good support for <=8.4.

I suggest to just address this per-PR and having this PR comment to be the official info for now. We can include some info into an announcement for the new doc, but I don't see much use in trying to reach potential contributors before that.

@wenzeslaus wenzeslaus added the manual Documentation related issues label Feb 19, 2025
@echoix
Copy link
Member

echoix commented Feb 19, 2025

It's fine with me, I wanted to see it written somewhere to refer to, as I wasn't involved too much in the design of the new docs

@wenzeslaus wenzeslaus merged commit 9c03296 into OSGeo:grass8 Feb 19, 2025
7 checks passed
@wenzeslaus wenzeslaus deleted the add-md-files branch February 19, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manual Documentation related issues
Projects
Development

Successfully merging this pull request may close these issues.

2 participants