Skip to content

Commit 72c86ba

Browse files
author
smeyer
committed
Rd2txt: document and use descStyle="linebreak"
git-svn-id: https://svn.r-project.org/R/trunk@88889 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent e23e24f commit 72c86ba

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

doc/NEWS.Rd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@
135135
completeness, corresponding to \code{.pretty()}. Also, it now
136136
catches typos such as \code{eps.corrected = 2}, noted in \PR{18521}
137137
by \I{Mikko Korpela}.
138+
139+
\item Plain-text help now renders Rd \verb{\describe} lists using
140+
line breaks after item labels. Set
141+
\code{tools::Rd2txt_options(descStyle=NULL)} to get the old
142+
behaviour with a simple space; a \code{"colon"} variant is also
143+
available.
138144
}
139145
}
140146

src/library/tools/R/Rd2txt.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Rd2txt_options <- local({
3737
sectionExtra = 2L,
3838
itemBullet = "* ",
3939
enumFormat = function(n) sprintf("%d. ", n),
40-
## descStyle = "none",
40+
descStyle = "linebreak",
4141
showURLs = FALSE,
4242
code_quote = TRUE,
4343
underline_titles = TRUE)

src/library/tools/man/Rd2txt_options.Rd

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% File src/library/tools/man/Rd2txt_options.Rd
22
% Part of the R package, https://www.R-project.org
3-
% Copyright 2010 R Core Team
3+
% Copyright 2010-2025 R Core Team
44
% Distributed under GPL 2 or later
55

66
\name{Rd2txt_options}
@@ -20,24 +20,29 @@ Rd2txt_options(...)
2020
\details{
2121
This function persistently sets various formatting options for the
2222
\code{\link{Rd2txt}} function which is used in displaying text format
23-
help. Currently defined options are:
23+
help. Currently defined options (defaults) are:
2424
\describe{
25-
\item{width}{(default 80): The width of the output page.}
26-
\item{minIndent}{(default 10): The minimum indent to use in a list.}
27-
\item{extraIndent}{(default 4): The extra indent to use in each
25+
\item{width (80)}{The width of the output page.}
26+
\item{minIndent (10)}{The minimum indent to use in a list.}
27+
\item{extraIndent (4)}{The extra indent to use in each
2828
level of nested lists.}
29-
\item{sectionIndent}{(default 5): The indent level for a section.}
30-
\item{sectionExtra}{(default 2): The extra indentation for each
29+
\item{sectionIndent (5)}{The indent level for a section.}
30+
\item{sectionExtra (2)}{The extra indentation for each
3131
nested section level.}
32-
\item{itemBullet}{(default \code{"* "}, with the asterisk replaced by a
33-
Unicode bullet in UTF-8 and most Windows locales):
34-
The symbol to use as a bullet in itemized lists.}
35-
\item{enumFormat}{: A function to format item numbers in enumerated lists.}
36-
\item{showURLs}{(default \code{FALSE}): Whether to show URLs when
32+
\item{itemBullet (\code{"* "}, but \code{"\\u2022 "} in UTF-8 locales)}{
33+
The symbol to use as a bullet in \verb{\itemize} lists.}
34+
\item{enumFormat (\code{function(n) sprintf("\%d. ", n)})}{
35+
A function to format item numbers in \verb{\enumerate} lists.}
36+
\item{descStyle (\code{"linebreak"})}{
37+
How to separate the item label from the body in \verb{\describe}
38+
lists. The alternative \code{"colon"} inserts a colon if the label
39+
does not already end with one. Use \code{NULL} for a simple space
40+
(as in \R < 4.6.0).}
41+
\item{showURLs (\code{FALSE})}{Whether to show URLs when
3742
expanding \verb{\href} tags.}
38-
\item{code_quote}{(default \code{TRUE}): Whether to render
43+
\item{code_quote (\code{TRUE})}{Whether to render
3944
\verb{\code} and similar with single quotes.}
40-
\item{underline_titles}{(default \code{TRUE}): Whether to render
45+
\item{underline_titles (\code{TRUE})}{Whether to render
4146
section titles with underlines (via backspacing).}
4247
}
4348
}
@@ -47,7 +52,7 @@ Rd2txt_options(...)
4752
previous values.
4853
}
4954
\author{
50-
Duncan Murdoch
55+
Duncan Murdoch and the R Core Team
5156
}
5257
\seealso{
5358
\code{\link{Rd2txt}}

tests/testit.txt.save

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ _V_a_l_u_e:
5151

5252
Yihui Xie's example:
5353

54-
def ghi
54+
def
55+
ghi
5556

5657
-
5758

0 commit comments

Comments
 (0)