Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new tutorial section for “Rewriting git history”, implemented as a Quarto Reveal.js presentation (with a bundled flandersqmd revealjs extension) and an index.md page linking to the rendered presentation.html.
Changes:
- Add Quarto Reveal.js presentation source (
presentation.qmd) explaining git history rewriting workflows. - Add a Quarto project config and post-render script to produce/clean presentation artifacts.
- Vendor a custom Quarto Reveal.js extension (
_extensions/inbo/flandersqmd) with CSS/filters/fonts/images.
Reviewed changes
Copilot reviewed 11 out of 33 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
content/tutorials/git_rewrite_history/presentation.qmd |
New slide deck content (dot graphs + git guidance). |
content/tutorials/git_rewrite_history/index.md |
Tutorial landing page linking to the generated HTML presentation. |
content/tutorials/git_rewrite_history/_quarto.yml |
Quarto project config for rendering the presentation. |
content/tutorials/git_rewrite_history/post_render.R |
Post-render clean-up/copy script for the generated presentation artifacts. |
content/tutorials/git_rewrite_history/_extensions/inbo/flandersqmd/* |
Bundled Reveal.js extension assets (SCSS/CSS, Lua filters, fonts/images, CSL). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 1. make sure you have checkout the correct branch | ||
| - `git checkout my_feature` |
There was a problem hiding this comment.
Spelling/grammar: “have checkout” should be “have checked out”.
| - apply the changes locally as describe in the previous chapter | ||
| - a simple `git push` will fail because of a diverging history |
There was a problem hiding this comment.
Spelling/grammar: “as describe” should be “as described”.
| border-left-color: var(--flandersqmd-callout-warning-border); | ||
| } | ||
|
|
||
| .reveal div.callout.callout-note.warning-style-default .callout-title{ |
There was a problem hiding this comment.
The selector .reveal div.callout.callout-note.warning-style-default .callout-title looks like a typo (it targets a note callout, not a warning callout). As written, warning callouts may not get the intended title background color; this likely should target .callout-warning and the standard callout style class.
| .reveal div.callout.callout-note.warning-style-default .callout-title{ | |
| .reveal div.callout.callout-warning.callout-style-default .callout-title{ |
| - apply the changes locally as describe in the previous chapter | ||
| - a simple `git push` will fail because of a diverging history | ||
| - you must use `git push --force` or `git push -f` | ||
| - be carefull because you can't undo that |
There was a problem hiding this comment.
Spelling: “carefull” should be “careful”.
| resources$contributes$format$revealjs[["format-resources"]] |> | ||
| basename() |> | ||
| file.remove() -> hide |
There was a problem hiding this comment.
basename() |> file.remove() will delete files in the current working directory matching those basenames. If Quarto's post-render runs from the project root, this can accidentally delete source assets if names collide. Safer: construct explicit paths to the files you intend to delete (e.g., within output/) and/or check file.exists() before removal.
| local url_div = pandoc.Div({pandoc.Para({pandoc.Str(this_url)})}, pandoc.Attr("", {"sidebar-url-tussen"})) | ||
| ent_logo = pandoc.Div("", { class = "entity-tussen" }) | ||
| if (this_lang == "nl-BE") then | ||
| if (entitycolours == "inbo") then | ||
| vl_logo = pandoc.Image("Vlaanderen is wetenschap", "flanders-nl-transparent.png") | ||
| ent_logo = pandoc.Image("Instituut voor Natuur- en Bosonderzoek", "inbo-nl-white.png") | ||
| ent_logo.attr = {class = "entity-tussen"} | ||
| else | ||
| vl_logo = pandoc.Image("Vlaanderen, verbeelding werkt", "flanders-nl-intermediate.jpg") | ||
| end | ||
| vl_logo.attr = {class = "vl-tussen"} | ||
| else |
There was a problem hiding this comment.
Pandoc Lua attributes/classes are set using pandoc.Attr (or by mutating elem.attr.classes), but this filter assigns classes via vl_logo.attr = {class = ...} and passes { class = ... } directly to pandoc.Div(). This likely won't apply the classes (or may error on some Pandoc versions); use pandoc.Attr("", {"vl-tussen"}) / pandoc.Attr("", {"entity-tussen"}) consistently.
| :::: | ||
|
|
||
|
|
||
| ## Commiting to current branch |
There was a problem hiding this comment.
Spelling: section title should be “Committing” (double ‘m’).
| function display_person (person, i) | ||
| res = "" | ||
| if is_empty(person.name) then | ||
| res = '<h1 class = "missing">!!! flandersqmd.authors element ' .. i .. ' has no name element!!!</h1>' | ||
| return res | ||
| end | ||
| if is_empty(person.name.given) then | ||
| res = '<h1 class = "missing">!!! flandersqmd.authors element ' .. i .. ' has no given element under name!!!</h1>' | ||
| return res | ||
| end | ||
| if is_empty(person.name.family) then | ||
| res = '<h1 class = "missing">!!! flandersqmd.authors element ' .. i .. ' has no given element under name!!!</h1>' | ||
| return res | ||
| end | ||
| if is_empty(person.email) then | ||
| res = pandoc.utils.stringify(person.name.given) .. ' ' .. pandoc.utils.stringify(person.name.family) | ||
| else | ||
| res = res .. '<a href= "mailto:' .. pandoc.utils.stringify(person.email) .. '" class = "title email">' .. pandoc.utils.stringify(person.name.given) .. ' ' .. pandoc.utils.stringify(person.name.family) .. '</a>' | ||
| end | ||
| if (is_empty(person.orcid)) then | ||
| return res | ||
| end | ||
| res = res .. '<a href="https://orcid.org/' .. pandoc.utils.stringify(person.orcid) .. '" class="quarto-title-author-orcid"> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo1N0NEMjA4MDI1MjA2ODExOTk0QzkzNTEzRjZEQTg1NyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozM0NDOEJGNEZGNTcxMUUxODdBOEVCODg2RjdCQ0QwOSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozM0NDOEJGM0ZGNTcxMUUxODdBOEVCODg2RjdCQ0QwOSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZDN0YxMTc0MDcyMDY4MTE5NUZFRDc5MUM2MUUwNEREIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjU3Q0QyMDgwMjUyMDY4MTE5OTRDOTM1MTNGNkRBODU3Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+84NovQAAAR1JREFUeNpiZEADy85ZJgCpeCB2QJM6AMQLo4yOL0AWZETSqACk1gOxAQN+cAGIA4EGPQBxmJA0nwdpjjQ8xqArmczw5tMHXAaALDgP1QMxAGqzAAPxQACqh4ER6uf5MBlkm0X4EGayMfMw/Pr7Bd2gRBZogMFBrv01hisv5jLsv9nLAPIOMnjy8RDDyYctyAbFM2EJbRQw+aAWw/LzVgx7b+cwCHKqMhjJFCBLOzAR6+lXX84xnHjYyqAo5IUizkRCwIENQQckGSDGY4TVgAPEaraQr2a4/24bSuoExcJCfAEJihXkWDj3ZAKy9EJGaEo8T0QSxkjSwORsCAuDQCD+QILmD1A9kECEZgxDaEZhICIzGcIyEyOl2RkgwAAhkmC+eAm0TAAAAABJRU5ErkJggg=="></a>' | ||
| return res |
There was a problem hiding this comment.
The display_person function builds raw HTML using unescaped values from person.name.*, person.email, and person.orcid, and returns it via pandoc.RawInline('html', ...). If any of these metadata fields contain characters like quotes or <script> tags (for example via flandersqmd.author in the document YAML), they will be injected directly into the generated HTML, enabling cross-site scripting in the rendered tutorial pages. To fix this, avoid concatenating unescaped metadata into HTML strings; instead, construct pandoc element nodes (e.g., Link, Str) so Pandoc escapes content correctly, or at minimum HTML-escape user-provided metadata before concatenation.
ElsLommelen
left a comment
There was a problem hiding this comment.
I did not do a complete review, but I used one of the commands from the presentation a while ago and I noticed some problem with it, so I hope this can be checked and corrected before publishing?
| 1. go the branch to which you want to add commits | ||
| - `git checkout my_feature` | ||
| 1. rebase the branch you want to add | ||
| - `git rebase other_feature` |
There was a problem hiding this comment.
I tried these commands some months ago, and I noticed it did not match with the graph on the next page. As I didn't realise this was part of a PR that needed I review, I wrote the following text (in Dutch) directly to the author. So please check this carefully before publishing, because using a wrong command can completely mess up your repo.
The Dutch review: Mijn situatie was dat ik een nieuwe versie van de main aangemaakt had met enkele commits uit een feature branch en nog wat extra commits, en dat ik nu de rest van de feature branch naar het eindpunt van de main wou verschuiven. Gelijkaardig aan pagina's 14 en 15 van je presentatie heb ik dus eerst een checkout van de main gedaan (de branch waarop ik de commits wil toevoegen), en daarna 'git rebase feature' ingegeven (de branch die ik wil verplaatsen). Het resultaat is zeker niet wat ik verwacht had: de feature branch is helemaal niet op de eerdere main (origin/main) gezet, en het lijkt erop dat er eerder een omgekeerde bewerking gebeurd is: vanuit de vorige versie van de main eerst de feature branch toegevoegd, en daarna de main.
Als ik er deze website bij neem, dan geeft die aan dat ik een checkout van mijn feature branch had moeten doen en dan het commando 'git rebase main' uitvoeren, wat net het omgekeerde is van hoe het in je presentatie staat... Je presentatie geeft alles overzichtelijk weer en het klonk logisch, eerlijk gezegd logischer dan ik tot nu toe tegengekomen was (want ik moet het altijd opzoeken omdat ik de logica van de rebase-commando's nog steeds niet goed door heb m.u.v. de interactieve), maar helaas bleek het niet het juiste commando te zijn. 🫣
Description
The presentation of a BMK talk
Task list
tutorials/content/index.md. In case of an Rmarkdown tutorial I have knitted myindex.Rmdtoindex.md(both files are pushed to the repo).yamlheader:authorsyaml tag, using[MY_AUTHOR_ID]. An author information file exists in<tutorials>/data/authors/<author>.toml.categoriesto the YAML header and my category tags are from the list of categories.tags(i.e. keywords) in the YAML header to improve the visibility of the new tutorial (see the tags listed in the tutorials website side bar).dateis in formatYYYY-MM-DDand adjusted.Previewing the pull request
Thanks to GitHub Actions, an artifact (=zip file) of the rendered website is automatically created for each pull request.
This provides a way to preview how these updates will look on the website, useful to contributors and reviewers.
Instructions to preview the updated website
Downloads/tutorials_preview.httpsites on your local machine. One such option is theservrpackage in R:& '\C:\Program Files\R\R-4.4.2\bin\Rscript.exe' -e "servr::httd('./tutorials_preview')" -p8887(make sure to adjust the path to yourRscript.exe; on Linux, simply useRscript -e [...]).Note: for step 3, you can use any other simple HTTP server to serve the current directory, e.g. Python
http.server:python -m http.server 8887 --bind localhost --directory path/to/tutorials_previewAlternative: Locally Building the Site
Alternatively, you can build the entire site locally (see the README for instructions); the Hugo preview server will update changes on the fly.
This requires Hugo to be installed on your computer.