You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On my Mac, a warning message is issued with the following minimal call to markdown::mark_html().
.<-markdown::mark_html("hello")
#> Warning in file.info(x, extra_cols = FALSE): expanded path length 1663 would be too long for#> <style type="text/css">#> body {#> font-family: sans-s [... truncated]
This warning appears because xfun::file_exists(), or ultimately file.info(), is attempted against the content of the CSS file. With default.css, this warning may only appear on Mac, where the maximum path length is 1023. With a larger CSS file, the same warning could appear on other platforms, I suppose.
After some struggles, I noticed that this warning shows up only when the meta$css is given as an absolute path.
oopts<- options()
options(warning.length=100)
# Copy the default CSS to simulate custom CSS
dir.create(tdir<- tempfile(pattern="dir", tmpdir="."))
.<- file.copy(system.file("resources/default.css", package="markdown"), tdir)
(custom_css<- file.path(tdir, "default.css"))
#> [1] "./dir7b19758ba261/default.css"# No warning with a relative pathrelative<-markdown::mark_html("hello", meta=list(css=custom_css))
# Warning appears for an absolute pathabsolute<-markdown::mark_html("hello", meta=list(css= normalizePath(custom_css)))
#> Warning in file.info(x, extra_cols = FALSE): expanded path length 1663 would be too long for#> <style type="text/css">#> body {#> font-family: sans-s [... truncated]
unlink(tdir, recursive=TRUE)
options(oopts)
My intention is to write a package that calls markdown::mark() with a custom CSS, which will be passed with a system.file()-generated absolute path. It would be great if there is a clean way to avoid the file.info() warning. (i.e., cleaner than using suppressWarnings() I mean...)
Would you have any recommendations? Thanks!
The text was updated successfully, but these errors were encountered:
On my Mac, a warning message is issued with the following minimal call to
markdown::mark_html()
.Created on 2023-08-21 with reprex v2.0.2
This warning appears because
xfun::file_exists()
, or ultimatelyfile.info()
, is attempted against the content of the CSS file. Withdefault.css
, this warning may only appear on Mac, where the maximum path length is 1023. With a larger CSS file, the same warning could appear on other platforms, I suppose.After some struggles, I noticed that this warning shows up only when the
meta$css
is given as an absolute path.Created on 2023-08-21 with reprex v2.0.2
My intention is to write a package that calls
markdown::mark()
with a custom CSS, which will be passed with asystem.file()
-generated absolute path. It would be great if there is a clean way to avoid thefile.info()
warning. (i.e., cleaner than usingsuppressWarnings()
I mean...)Would you have any recommendations? Thanks!
The text was updated successfully, but these errors were encountered: