Skip to content

Commit

Permalink
explain second argument of doc.to_string
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomocavalieri committed Apr 26, 2024
1 parent 99fed83 commit 7625f12
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/glam/doc.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,9 @@ pub const soft_break: Document = Break("", "")
///
pub const space: Document = Break(" ", "")

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

type Mode {
Expand Down

0 comments on commit 7625f12

Please sign in to comment.