Conversation
…t.g2, add workflows, examples, NEWS.md Co-authored-by: yihui-bot <264330240+yihui-bot@users.noreply.github.com>
….onLoad Co-authored-by: yihui-bot <264330240+yihui-bot@users.noreply.github.com>
yihui-bot
left a comment
There was a problem hiding this comment.
have you tested examples in all R code chunks in all Rmd with headless browsers? if not, please do; if errors are found, please fix them
| @@ -0,0 +1,23 @@ | |||
| # gglite 0.0.1 | |||
There was a problem hiding this comment.
the first heading in NEWS.md always represents the dev version and it should be of the form # PKG x.y where PKG is the package name, and x.y is the next version to be released to CRAN (note it's x.y, not x.y.0); usually y is bumped from the current minor version, e.g., if the current dev version is 1.8.3, the next CRAN release is expected to be 1.9
revise the version number and add this to copilot instructions accordingly
There was a problem hiding this comment.
Fixed in a1d78a8. NEWS.md heading now uses # gglite 0.1 format. Added the convention to .github/copilot-instructions.md under Build and Package Conventions item 8.
| - Changed `g2_col_cdn()` from a function to a constant `g2_col_cdn` since the | ||
| CDN URL is unlikely to change. | ||
|
|
||
| - Refactored the CDN `<script>` tags in `preview()` and `knit_print.g2()` into | ||
| a shared helper `cdn_scripts()` to reduce code repetition. | ||
|
|
||
| - Added `record_print.g2()` S3 method for `xfun::record_print()` so that | ||
| litedown can render gglite plots correctly in Rmd documents. | ||
|
|
||
| - Added `.github/copilot-instructions.md` for Copilot development guidance. | ||
|
|
||
| - Added `.github/workflows/copilot-setup-steps.yml` for Copilot environment | ||
| setup. | ||
|
|
||
| - Added `.github/workflows/github-pages.yml` for building the package site with | ||
| litedown. | ||
|
|
||
| - Added `examples/` directory with extensive Rmd examples for each gglite | ||
| component (marks, scales, coordinates, themes, transforms, interactions, | ||
| facets, animations, axes, legends, titles, tooltips, labels, styles, sliders, | ||
| and scrollbars). |
There was a problem hiding this comment.
don't mention trivial technical details that are worthless to end users
for v0.1, just provide a summary of what this package does since everything is new
There was a problem hiding this comment.
Fixed in a1d78a8. NEWS.md now just summarizes what the package does for v0.1.
| registerS3method('record_print', 'g2', record_print.g2, | ||
| envir = asNamespace('xfun')) |
There was a problem hiding this comment.
not necessary; method already exported
There was a problem hiding this comment.
Already removed in 540ec20 (previous commit). .onLoad() now only registers knit_print.g2 (since knitr is in Suggests, not Imports).
| '<script defer src="', g2_cdn(), '"></script>\n', | ||
| '<script defer src="', g2_col_cdn, '"></script>' |
There was a problem hiding this comment.
put defer at the end:
| '<script defer src="', g2_cdn(), '"></script>\n', | |
| '<script defer src="', g2_col_cdn, '"></script>' | |
| '<script src="', g2_cdn(), '" defer></script>\n', | |
| '<script src="', g2_col_cdn, ' defer"></script>' |
actually you should avoid repetition by a single sprintf() call that accepts a char vector of both g2 cdn and g2 col cdn
and there's no need to concatenate HTML by \n: both litedown and xfun supports char vectors; you only need to join by \n for knit_print.g2(); use natural char vectors elsewhere and don't join by \n
There was a problem hiding this comment.
Fixed in a1d78a8. cdn_scripts() now uses sprintf('<script src="%s" defer></script>', c(g2_cdn(), g2_col_cdn)) returning a char vector. preview() and record_print.g2() use natural char vectors; only knit_print.g2() joins by \n.
….md format, test and fix all Rmd examples in headless browser Co-authored-by: yihui-bot <264330240+yihui-bot@users.noreply.github.com>
Co-authored-by: yihui-bot <264330240+yihui-bot@users.noreply.github.com>
Tested all Rmd examples in headless Chromium via Playwright (a1d78a8). Found and fixed 9 broken examples:
All 129 remaining chart examples now render without JS errors. |
Multiple improvements: make static CDN URL a constant, add litedown rendering support, reduce code duplication, set up Copilot/CI infrastructure, and add extensive component examples verified in headless browsers.
R code changes
g2_col_cdn: converted from function to constant (URL is static)cdn_scripts(): extracted shared helper using a singlesprintf()call with a char vector of both CDN URLs; returns a character vector (no\njoining).deferattribute placed at end of<script>tags. Onlyknit_print.g2()joins by\n;preview()andrecord_print.g2()use natural char vectors.record_print.g2(): new S3 method via@importFrom xfun record_print+@export, returns HTML wrapped inxfun::new_record(out, 'asis')for litedown rendering.onLoad(): removed unnecessaryregisterS3method()forrecord_print(method is already exported; onlyknit_printremains dynamically registered since knitr is in Suggests)CI/Copilot setup
.github/copilot-instructions.md— adapted from tinyimg (no Rust), emphasizes headless browser testing and NEWS.md updates. Includes NEWS.md version convention: first heading must be# PKG x.yformat..github/workflows/copilot-setup-steps.yml— R-only setup.github/workflows/github-pages.yml— litedown-based site buildNEWS.md
# gglite 0.1heading format per conventionExamples
examples/directory (excluded via.Rbuildignore) with 12 Rmd files covering: marks, scales, coordinates, themes, transforms, interactions, facets, animations, axes/legends, titles/tooltips, labels/styles, sliders/scrollbars💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.