Releases: yihui/xfun
xfun 0.49
-
Added an argument
use_block = FALSE
toprotect_math()
. Whenuse_block = TRUE
, a$$ $$
expression that spans across multiple lines will be protected in a code block. -
protect_math()
will ignore$ $
if there are backticks after the opening$
or before the closing$
, e.g.,$`this is not math`$
. -
protect_math()
allows for parentheses()
around math expressions now, e.g.,($x$)
was previously not recognized but is recognized now (thanks, @AlbertLei, yihui/litedown#34). -
record()
works withquote()
now (thanks, @ben-schwen, yihui/litedown#38). -
html_escape()
will not escape double quotes (i.e., convert"
" to"
) by default, and the conversion will be done only forhtml_escape(attr = TRUE)
. -
The arguments
before
andafter
ofread_all()
can take functions of two arguments now, with the second argument being the content of each file. -
Added an argument
start
tomake_fence()
.
xfun 0.48
-
Added utilities for HTML tags:
html_tag()
,html_escape()
,html_escape()
, andhtml_view()
. Removed the soft dependency on the htmltools package accordingly. -
base_pkgs()
is faster now: it callstools::standard_package_names()
if the function exists (R >= 4.4.0), otherwise it just returns a constant vector of base package names (thanks, @arnaudgallou, #91). -
Added a function
mime_type()
to obtain the MIME types of files viamime::guess_type()
if mime is installed, otherwise it will calltools:::mime_type()
, and fall back to using a system command (e.g.,file --mime-type
) to obtain the types. -
Added a function
file_rename()
to deal withfile.rename()
failures by callingfile.copy()
(thanks, @Giqles @katrinabrock, rstudio/bookdown#804). -
new_app()
will useutils::browseURL()
to open the app ifoptions('viewer')
is not configured (thanks, @AlbertLei, yihui/litedown#29). -
Added a method
record_print.record_asis()
to return the object as is.
xfun 0.47
-
Added functions
lazy_save()
andlazy_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
xfun 0.45
xfun 0.44
-
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 thancache_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
torecord()
to make it possible to enable caching. -
Added arguments
message
andwarning
torecord()
to decide whether messages and warnings should be recorded. -
Changed the default value of the argument
error
ofrecord()
fromFALSE
toNA
. NowFALSE
means to suppress error messages, andNA
means to throw errors normally. This is for consistency with themessage
andwarning
arguments. -
Added an S3 generic function
record_print()
, which is similar toknitr::knit_print()
but for the purpose of printing visible values inrecord()
. -
The
record()
funciton gained new argumentsprint
andprint.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 fortools::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()
forfenced_block(char = ':')
. -
write_utf8()
returns thecon
argument (typically a file path) now. Previously, it returnsNULL
. -
Added an experimental function
new_app()
to create a local web application. -
The returned value of
yaml_body()
contains a new elementlines
in the list indicating the line numbers of YAML metadata if exists. -
Removed the
skip
argument fromsplit_source()
. -
For
split_source(line_number = TRUE)
, the attribute name for line numbers in the returned value was changed fromline_start
(a single starting line number) tolines
(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
-
Added a function
upload_imgur()
, which was adapted fromknitr::imgur_upload()
. The latter will call the former in the future.xfun::upload_imgur()
allows users to choose whether to use the system commandcurl
or the R package curl to upload the image. It also has a new argumentinclude_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 argumentverbose = 1
or2
.
xfun 0.42
-
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 toevaluate::evaluate()
but less sophisticated and technically simpler. One major difference is thatxfun::record()
records plots directly to files instead of saving them as display lists. -
yaml_load()
gained anenvir
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 toyaml_load()
. -
split_source()
gained amerge_comments
argument to merge consecutive lines of comments into the next code block, aline_number
argument to store the line number of each expression in the returned value, and askip
argument to skip the rest of the code when the skip token is found. -
check_old_package()
has been vectorized, i.e., the argumentsname
andversion
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()
anddivide_chunk()
, respectively. They will be used by knitr and other packages in future. -
Added a function
decimal_dot()
to evaluate an expression after forcingoptions(OutDec = '.')
andSys.setlocale(LC_NUMERIC = 'C')
(for rstudio/rmarkdown#2525).
xfun 0.41
xfun 0.40
-
number_to_words()
supports decimal numbers now (thanks, @harshvardhaniimi, #80). -
is_ascii()
is more robust now (thanks, @bastistician, #81).