Add reactable demo and fix renv project detection in Makefile
- Add reactable-demo post exercising the full statdown/depkit htmlwidget pipeline (two reactable tables with filtering) - Replace renv::restore() with renv::load() using explicit project root in Makefile and watch-rmd.sh — renv could not find the lockfile when cd'd into post subdirectories Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2
Makefile
2
Makefile
@@ -92,7 +92,7 @@ LIBS_URL := /libs
|
||||
# Assets are written to static/libs/ so they are shared across posts
|
||||
%/index.md: %/index.Rmd renv.lock
|
||||
@echo "🔄 Rendering $<"
|
||||
cd $* && Rscript -e 'renv::restore(prompt = FALSE); statdown::statdown_render("index.Rmd", output_root = "$(CURDIR)/$(LIBS_DIR)", url_root = "$(LIBS_URL)")'
|
||||
cd $* && Rscript -e 'renv::load("$(CURDIR)"); statdown::statdown_render("index.Rmd", output_root = "$(CURDIR)/$(LIBS_DIR)", url_root = "$(LIBS_URL)")'
|
||||
|
||||
#-----------------------------------------------------------------------------#
|
||||
#
|
||||
|
||||
3
content/posts/reactable-demo/.gitignore
vendored
Normal file
3
content/posts/reactable-demo/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
index.md
|
||||
figure/
|
||||
libs/
|
||||
43
content/posts/reactable-demo/index.Rmd
Normal file
43
content/posts/reactable-demo/index.Rmd
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: "Interactive Table Demo"
|
||||
date: "2025-03-17"
|
||||
slug: "reactable-demo"
|
||||
draft: true
|
||||
---
|
||||
|
||||
This post demonstrates an interactive table rendered through the
|
||||
statdown/depkit pipeline. The `reactable` package creates an htmlwidget,
|
||||
which statdown hands off to depkit for CSS/JS asset management.
|
||||
|
||||
```{r setup, include=FALSE}
|
||||
knitr::opts_chunk$set(
|
||||
echo = FALSE,
|
||||
warning = FALSE,
|
||||
message = FALSE
|
||||
)
|
||||
```
|
||||
|
||||
## Basic Table
|
||||
|
||||
```{r basic-table}
|
||||
library(reactable)
|
||||
|
||||
reactable(mtcars[1:10, ], filterable = TRUE, searchable = TRUE)
|
||||
```
|
||||
|
||||
## Styled Table
|
||||
|
||||
```{r styled-table}
|
||||
reactable(
|
||||
iris[1:15, ],
|
||||
columns = list(
|
||||
Sepal.Length = colDef(name = "Sepal Length"),
|
||||
Sepal.Width = colDef(name = "Sepal Width"),
|
||||
Petal.Length = colDef(name = "Petal Length"),
|
||||
Petal.Width = colDef(name = "Petal Width")
|
||||
),
|
||||
striped = TRUE,
|
||||
highlight = TRUE,
|
||||
bordered = TRUE
|
||||
)
|
||||
```
|
||||
@@ -12,7 +12,7 @@ inotifywait -m -e close_write --format '%w%f' -r "$WATCH_DIR" | while read FILE;
|
||||
|
||||
echo "🔄 Change detected in $FILE. Rendering..."
|
||||
|
||||
(cd "$POST_DIR" && Rscript -e 'renv::restore(prompt = FALSE); statdown::statdown_render("index.Rmd", output_root = "'"${PROJECT_ROOT}/${LIBS_DIR}"'", url_root = "'"${LIBS_URL}"'")')
|
||||
(cd "$POST_DIR" && Rscript -e 'renv::load("'"${PROJECT_ROOT}"'"); statdown::statdown_render("index.Rmd", output_root = "'"${PROJECT_ROOT}/${LIBS_DIR}"'", url_root = "'"${LIBS_URL}"'")')
|
||||
|
||||
echo "✅ Rendered ${FILE}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user