diff options
| author | Russ Cox <rsc@golang.org> | 2022-04-05 17:10:20 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2022-04-05 21:11:24 +0000 |
| commit | e9af402b19db4352e7831b33a3f47719e86a5267 (patch) | |
| tree | 035cd204792f6ac6c210be79ca303dd89dc66edf | |
| parent | 430b4d8eef42b281a9e798b6d9ac113647c3ba62 (diff) | |
| download | go-x-proposal-e9af402b19db4352e7831b33a3f47719e86a5267.tar.xz | |
design/51082-godocfmt: add Printer fields for Text output
These are needed to provide the old go/doc API faithfully.
For golang/go#51082.
Change-Id: I975551873fdfd5fccae51280300bff14f2059aee
Reviewed-on: https://go-review.googlesource.com/c/proposal/+/398535
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
| -rw-r--r-- | design/51082-godocfmt.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/design/51082-godocfmt.md b/design/51082-godocfmt.md index d2509df..d6841d8 100644 --- a/design/51082-godocfmt.md +++ b/design/51082-godocfmt.md @@ -939,6 +939,23 @@ type Printer struct { // passed to [DocLink.DefaultURL] to construct a DocLink's URL. // See that method's documentation for details. DocLinkBaseURL string + + // TextPrefix is a prefix to print at the start of every line + // when generating text output using the Text method. + TextPrefix string + + // TextCodePrefix is the prefix to print at the start of each + // preformatted (code block) line when generating text output, + // instead of (not in addition to) TextPrefix. + // If TextCodePrefix is the empty string, it defaults to TextPrefix+"\t". + TextCodePrefix string + + // TextWidth is the maximum width text line to generate, + // measured in Unicode code points, + // excluding TextPrefix and the newline character. + // If TextWidth is zero, it defaults to 80 minus the number of code points in TextPrefix. + // If TextWidth is negative, there is no limit. + TextWidth int } A Printer is a doc comment printer. The fields in the struct can be filled in before calling any of the printing methods in order to customize the |
