Skip to content

Commit

Permalink
doc: document reset
Browse files Browse the repository at this point in the history
  • Loading branch information
sorawee committed Jan 18, 2024
1 parent 52cd12b commit e57f828
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scribblings/pretty-expressive.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,21 @@ both @tech{doc} construction and @racket[pretty-print] would be inefficient.
]
}

@defproc[(reset [d doc?]) doc?]{
Resets the indentation level to 0 when rendering the @tech{doc} @racket[d].
This is especially useful for formatting multi-line strings and multi-line comments.

@examples[#:eval evaluator
(define subd (reset (<> (text "#<<EOF") nl
(text "Zelda") nl
(text "Baba is you") nl
(text "EOF"))))
(pretty-print (<> (text "when 1 = 2:")
(nest 4 (<> nl (text "print ") subd))))
]
}


@defthing[fail doc?]{
Constructs a @tech{doc} that fails to render.
This doc interacts with @racket[alt]: failing branches are pruned away.
Expand Down

0 comments on commit e57f828

Please sign in to comment.