Skip to content

Releases: yihui/xfun

xfun 0.47

17 Aug 04:27
Compare
Choose a tag to compare
  • Added functions lazy_save() and lazy_load() to save objects to files and lazy-load them.

  • Fixed a bug in record(dev = svglite::svglite) that misplaced plots when low-level plot functions are used (thanks, @liao961120, yihui/litedown#17).

  • Specified the lowest R version required (v3.2.0) for this package.

xfun 0.46

22 Jul 22:03
Compare
Choose a tag to compare
  • md_table() should add a vertical ellipsis to row names when rows are truncated by the limit argument.

  • session_info() recognizes Positron now (thanks, @chuxinyuan, #89).

xfun 0.45

16 Jun 23:58
Compare
Choose a tag to compare
  • For record() with verbose = 1 or 2, invisible NULL is no longer printed.

  • Rscript_call() will show the actual error message (if an error occurred) during calling the function in a new R session.

xfun 0.44

15 May 12:51
Compare
Choose a tag to compare
  • Added a function cache_exec() to cache the execution of an expression either in memory or on disk. It is much more general and flexible than cache_rds(). For example, it supports custom reading/writing methods for cache files, and can load locally created variables in the expression while loading cache.

  • Added an argument cache to record() to make it possible to enable caching.

  • Added arguments message and warning to record() to decide whether messages and warnings should be recorded.

  • Changed the default value of the argument error of record() from FALSE to NA. Now FALSE means to suppress error messages, and NA means to throw errors normally. This is for consistency with the message and warning arguments.

  • Added an S3 generic function record_print(), which is similar to knitr::knit_print() but for the purpose of printing visible values in record().

  • The record() funciton gained new arguments print and print.args to support custom printing functions and arguments.

  • Added a function md_table(), which is a minimal Markdown table generator.

  • Exported the internal function md5() to calculate the MD5 checksums of R objects. The function is essentially a workaround for tools::md5sum() (see HenrikBengtsson/Wishlist-for-R#21).

  • For fenced_block(), a space is added between the backticks and the language name, e.g., ```r has become ``` r now. This will affect snapshot tests based on Markdown (an example).

  • Added a shorthand fenced_div() for fenced_block(char = ':').

  • write_utf8() returns the con argument (typically a file path) now. Previously, it returns NULL.

  • Added an experimental function new_app() to create a local web application.

  • The returned value of yaml_body() contains a new element lines in the list indicating the line numbers of YAML metadata if exists.

  • Removed the skip argument from split_source().

  • For split_source(line_number = TRUE), the attribute name for line numbers in the returned value was changed from line_start (a single starting line number) to lines (both the starting and ending numbers).

  • Fixed an edge case in prose_index(), in which inline code was incorrectly recognized as a code block fence.

xfun 0.43

25 Mar 16:57
Compare
Choose a tag to compare
  • Added a function upload_imgur(), which was adapted from knitr::imgur_upload(). The latter will call the former in the future. xfun::upload_imgur() allows users to choose whether to use the system command curl or the R package curl to upload the image. It also has a new argument include_xml to specify whether the XML response needs to be included in the returned value.

  • Added a function fenced_block() to create a fenced block in Markdown (thanks, @cderv, yihui/knitr#2331). The block can be either a code block or a fenced Div.

  • Fixed a bug in xfun::record() when the argument verbose = 1 or 2.

xfun 0.42

08 Feb 19:25
Compare
Choose a tag to compare
  • isFALSE() has been fully deprecated for R >= 3.5.0, and will be completely removed from this package in the future (https://yihui.org/en/2023/02/xfun-isfalse/).

  • Added a function record() to run R code and record the results, which is similar to evaluate::evaluate() but less sophisticated and technically simpler. One major difference is that xfun::record() records plots directly to files instead of saving them as display lists.

  • yaml_load() gained an envir argument, which can be used to specify the environment to evaluate R expressions in YAML (i.e., expressions written after !expr or !r). This is not straightforward in the upstream yaml package (thanks, @viking, vubiostat/r-yaml#54).

  • yaml_body() gained the ... argument to pass more arguments to yaml_load().

  • split_source() gained a merge_comments argument to merge consecutive lines of comments into the next code block, a line_number argument to store the line number of each expression in the returned value, and a skip argument to skip the rest of the code when the skip token is found.

  • check_old_package() has been vectorized, i.e., the arguments name and version can take vectors now.

  • Factored out the code for parsing chunk options and dividing a chunk into chunk options and chunk body from knitr to this package as functions csv_options() and divide_chunk(), respectively. They will be used by knitr and other packages in future.

  • Added a function decimal_dot() to evaluate an expression after forcing options(OutDec = '.') and Sys.setlocale(LC_NUMERIC = 'C') (for rstudio/rmarkdown#2525).

xfun 0.41

01 Nov 14:05
Compare
Choose a tag to compare
  • process_file() will write to the file only if the processed text is different with the input text. This is to avoid writing files unnecessarily.

  • session_info() will remove extra blank lines (thanks, @chuxinyuan, #82) and also omit the time zone info.

xfun 0.40

09 Aug 22:54
Compare
Choose a tag to compare

xfun 0.39

20 Apr 13:41
Compare
Choose a tag to compare
  • Fixed a bug that protect_math() fails to protect the starting $$ that has leading white spaces.

  • Added a function strip_html() to remove HTML tags and comments from text.

  • The function alnum_id() will remove HTML tags and comments from text (using strip_html()) before converting it to an ID string.

  • Added a function env_option() to retrieve an option value from options(). If the option does not exist there, check the environment variables. This provides a way for users to set an option via either options() or an environment variable.

xfun 0.38

24 Mar 12:30
Compare
Choose a tag to compare
  • Added an object download_cache, which is a list of methods to download a URL, cache the result, retrieve the result from the cache, and clear the cache.

  • Added an argument default to url_filename() to provide a default filename when it cannot be determined from the URL.

  • Added a function yaml_load() to read YAML data when the yaml package is not available. It only supports a limited number of data types and is supposed to be used as a fallback method. See the help page ?xfun::yaml_load for details.

  • Added a function yaml_body() to split a document into YAML metadata and the body.

  • is_arm64() also supports Linux now (thanks, @eitsupi, #74).

  • is_blank() returns a logical vector of the same length as the input vector now, indicating if each element of the input is blank. Previously it returns a logical scalar indicating whether all elements are blank. If you want the old behavior, you can use all(is_blank()).