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

Add git history to pages #47

Merged

Conversation

peytondmurray
Copy link
Collaborator

@peytondmurray peytondmurray commented Oct 22, 2023

Summary

This PR adds git history to pages. Since I'm also adding in a little js to handle some clicks, I also added configs for prettier and eslint. To build we now need pandas (for rendering tables of git data) and gitpython (for fetching git history).

The git history button is in the right hand sidebar. It opens up a modal with a table of edits to the current page; git history is fetched at build time.

The way it works is that the "Show article history" button is actually a checkbox which toggles its state. When it's checked, the modal is shown with a CSS rule; otherwise the modal is hidden.

Changes

  • Added prettier and eslint configs
  • Added pandas and gitpython dependencies
  • Added template for rendering git history. The template is inserted into the right hand (secondary) sidebar

Notes

I considered using the bootstrap.js modal, but to be honest I was never able to get this to render properly (always showed up underneath the top nav bar), and the modal background itself always appeared above the dialog box, so you could never close it. Generally speaking the bootstrap.js components haven't been very easy to use with sphinx/pydata-sphinx-theme, and this was definitely a case where it was easier to roll my own modal.

Here's what it looks like:

image

Resolves #21.

@random-person-001
Copy link
Contributor

Would the intended user more likely wish to see the rendered page at that historical point in time, or the source code changes with that commit?

I am not sure myself. If we wanted a (mostly-correctly) rendered page at that point in time, we could point to ex
https://github.com/observational-dev/oawiki/blob/ff553518ef0921871c7216f41873aa79e70ff8e8/src/other/examplepage.md
where we currently point to
ff55351

Overall, thank you for the excellent feature, looks great!

Copy link
Contributor

@random-person-001 random-person-001 left a comment

Choose a reason for hiding this comment

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

Looks good; I just have the user question of whether someone looking through this is more likely to be interested in the source changes at that edit, or a rendered snapshot of the page at that point in time. Which I don't know the answer to

@peytondmurray
Copy link
Collaborator Author

Well, if they're digging that hard they can always reach out to wiki stooges for help understanding what they're looking at. Sadly github's markdown renderer won't handle any of the markdown extensions provided by myst-parser, so output will likely be somewhat garbled. I vote to keep it as is.

@peytondmurray peytondmurray merged commit 298b2dd into observational-dev:main Oct 23, 2023
2 checks passed
@peytondmurray peytondmurray deleted the add-git-log-to-articles branch October 23, 2023 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Contributor and article edit log
2 participants