Skip to content

downlit 0.4.0

Compare
Choose a tag to compare
@hadley hadley released this 29 Oct 21:06

Syntax highlighting

  • Messages, warnings, and errors now get a much more minimal style.
    Messages are styled the same way as output; and warnings and errors
    only style the "Warning" or "Error" text. This makes these types of
    output easier to read, and easier for package developers to style
    themselves.

  • Messages, warnings, and errors now retrieve their text using
    conditionMessage(), which supports more advanced types of conditions
    (@davidchall, #100).

  • The overall structure of the syntax highlighting has been overhauled.
    Now each line is wrapped in a <span> with class r-in (input code),
    r-out (output printed to console), r-plot (plots), r-msg (messages),
    r-wrn (warnings), and r-err (errors). Additionally, the prompt (#>)
    is wrapped in a <span class="r-pr">. Altogether, these changes
    should give much more flexibility for styling with CSS (#90).

  • ANSI escapes no longer generate invalid HTML (#79).

  • Changes to better support for HTML widgets and rgl in pkgdown
    (@dmurdoch, #78). In particular, evaluate_and_highlight() now returns
    an additional attribute containing all extra dependencies needed to render
    the returned HTML.

Auto-linking

  • Packages attached when you call library(package) (including by the
    tidyverse), are now taken into account when autolinking (#87).

  • In code blocks, custom infix operators are now autolinked (#89).
    In inline code, infix operators are no longer autolinked; this lead to too
    many false positives. You can still link with (e.g.) ?"-" (#86).

  • Inline calls with arguments (e.g. foo(1, 2)) are no longer auto-linked,
    as intended and documented (#82).

  • Autolinking vignette(foo, package = "pkg") no longer errors if pkg is not
    installed (#85).

  • Unusual help calls (e.g. help(a$b)), no longer generate errors (#77).

  • Rare warning about incomplete final line in autolink_url("pkgname::foo")
    is now suppressed (@dmurdoch, pkgdown#1419).

  • href_package() is now exported (#103).

  • Auto-linking is more likely to succeed when the remote package is not
    installed as downlit now looks for the URL using tools::CRAN_package_db()
    for CRAN packages, and and available.packages() for packages installed
    from non-CRAN repos (@ARawles, #108).

  • Functions in HTML <summary> elements are no longer autolinked
    (@gadenbuie, #105).