From 2a790a50c8a010c7aa239bfb41dec448f92a94de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 19 Dec 2024 11:44:12 +0100 Subject: [PATCH] docs: improve key docs Fix #77 --- README.Rmd | 11 +++++++++-- README.md | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/README.Rmd b/README.Rmd index 8a0adb1..45703fa 100644 --- a/README.Rmd +++ b/README.Rmd @@ -46,14 +46,21 @@ The DeepL API URL depends on your API plan. babeldown uses the DeepL _free_ API URL by default. If you use a Pro plan, set the API URL via -```{r} +```{r, eval=FALSE} Sys.setenv("DEEPL_API_URL" = "https://api.deepl.com") ``` ### API key Set your API key via the environment variable `DEEPL_API_KEY`. -You could store it with the [keyring](https://r-lib.github.io/keyring/index.html) package and retrieve it like so: + +You could store it with the [keyring](https://r-lib.github.io/keyring/index.html) package, once per user/machine. + +```r +keyring::key_set("deepl") # will prompt you to enter the key interactively +``` + +In any script you use babeldown, you'd retrieve the key like so: ```{r} Sys.setenv(DEEPL_API_KEY = keyring::key_get("deepl")) diff --git a/README.md b/README.md index 65ab85a..b9121f7 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ translate: Markdown strings (`babeldown::deepl_translate_quarto()`) and Hugo blog posts (`babeldown::deepl_translate_hugo()`) in particular. -With babeldown you can also _update_ translations, see `babeldown::deepl_update()`. +With babeldown you can also *update* translations, see +`babeldown::deepl_update()`. ## Installation and setup @@ -48,9 +49,17 @@ Sys.setenv("DEEPL_API_URL" = "https://api.deepl.com") ### API key -Set your API key via the environment variable `DEEPL_API_KEY`. You could -store it with the [keyring](https://r-lib.github.io/keyring/index.html) -package and retrieve it like so: +Set your API key via the environment variable `DEEPL_API_KEY`. + +You could store it with the +[keyring](https://r-lib.github.io/keyring/index.html) package, once per +user/machine. + +``` r +keyring::key_set("deepl") # will prompt you to enter the key interactively +``` + +In any script you use babeldown, you’d retrieve the key like so: ``` r Sys.setenv(DEEPL_API_KEY = keyring::key_get("deepl"))