-
-
Notifications
You must be signed in to change notification settings - Fork 311
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: script to convert HTML manual pages to markdown #4620
base: main
Are you sure you want to change the base?
Conversation
Script to convert recursively all .html files to .md (GitHub flavoured Markdown). (see related OSGeo#3849)
Is this only to have the script in the repo? After that, is it supposed to be one time use or always used? (I assume that the docs in the repo will be in markdown instead of html soon..) If it's supposed to be used only once, does it need to be part of the repo? If ever we convert all of our html files to markdown (+formatting), I suggest to have an intermediate PR that only does the rename, to have the GitHub history +blame follow the file, instead of deleting and adding files (which would happen if the markdown formatting would have a lot of changes + renames) |
I see the following use cases:
Yes, an idea is to do that with multiple PRs:
The "rename" comment I don't fully understand. |
I see the value of having this available for use outside of a one-time use, like add-ons outside of the osgeo/grass-addons repo.
I imagined that passing from html to markdown as the docs source would be done at once. Thus, no interim with both formats in the repo. Thus, to help navigating the history for the future, I was suggesting to have an interim commit in the main branch that renamed all html files to change the extension of html to md, without any content changes, and directly after, applying the conversion to md in these md files that are in fact html. Html can be used in md to some extent. However these two must be done right after the other, as I don't expect the html builds to be working in that interim commit. But I think it will greatly help navigating history by allowing to continue going back commits of the renamed file (instead of stopping there). |
The history would be nice and the HTML==MD is nice trick, but...
...I'm afraid we can't just replace the server infrastructure for HTML with Markdown/mkdocs at the same time as merging the PR, so I think the change needs to be gradual in one way or another. |
If the build process generates the html from the md, what changes would be needed on the web server infrastructure? Maybe a test with a staging instance might help. But I'll keep thinking about what might be best here.. |
Valid point about the git history. Suggestion:
|
That's what I was thinking about if we needed to have html too in parallel (vs a clean cutoff, switching to Md at once). |
utils/grass_html2md.sh
Outdated
|
||
# TODO: path to LUA file setting to be improved (./utils/pandoc_codeblock.lua) | ||
#wget https://raw.githubusercontent.com/OSGeo/grass/refs/heads/main/utils/pandoc_codeblock.lua -O "${TMP}/pandoc_codeblock.lua" | ||
TMP="utils" |
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.
Hardcoding utils below is simpler. For testing in combination with the other PR, assuming you wget right is a very safe assumption.
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.
The question is: hardcoding yes, but how?
With a relative path, the script will not work in standard or other addon repos.
We could prepare that in one PR and then "Allow rebase merging" for couple minutes to merge that PR with its two commits. This would not break or workaround the CI. |
The rename way seems also appealing because it is more natural: Even with several conversions done already here, I get plenty of HTML tags, some perhaps need to stay. cd dist.x86_64-pc-linux-gnu/docs/mkdocs/source
grep -Eor '<[a-zA-Z][^>]*>' *.md | grep -Ev '<https?://[^>]+>'
|
… in relative URLs; simplify path to utils
Using the latest version of this script, I still get a lot of warnings:
The reason is (example, see
Seems we overlooked that in #3849? Any idea, @landam? As the script of this PR runs before the parser is invoked a change in |
Change in f91a111 to avoid undesired escaping of Example: Before: After: |
Script to convert recursively all .html files to .md (GitHub flavoured Markdown).
This is not only relevant for the conversion in GRASS-core but also for GRASS-Addons.
(see related #3849)
Suggestions needed for: