Skip to content

Commit 7625f12

Browse files
explain second argument of doc.to_string
1 parent 99fed83 commit 7625f12

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/glam/doc.gleam

+5-3
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,9 @@ pub const soft_break: Document = Break("", "")
479479
///
480480
pub const space: Document = Break(" ", "")
481481

482-
/// Turns a document into a pretty printed string.
482+
/// Turns a document into a pretty printed string, trying to fit it into lines
483+
/// of maximum size specified by `limit`.
484+
///
483485
/// The pretty printed process can be thought of as follows:
484486
/// - the pretty printer first tries to print every group on a single line
485487
/// - all the `break` documents are rendered as their first argument
@@ -502,8 +504,8 @@ pub const space: Document = Break(" ", "")
502504
/// that will guide you through the implementation of a simple pretty printer,
503505
/// covering most of the Glam API.
504506
///
505-
pub fn to_string(doc: Document, width: Int) -> String {
506-
do_to_string("", width, 0, [#(0, Unbroken, doc)])
507+
pub fn to_string(doc: Document, limit: Int) -> String {
508+
do_to_string("", limit, 0, [#(0, Unbroken, doc)])
507509
}
508510

509511
type Mode {

0 commit comments

Comments
 (0)