Liking cljdoc? Tell your friends :D

How blank lines in source are handled

Any blank lines that appear at the "top level", that is, outside of a function definition and outside of an expression are never changed by zprint.

The question to be discussed here is -- how are blank lines within function definitions (and within other expressions, for example def expressions) handled?

By default classic zprint will ignore blank lines in function definitions and other expressions.

There are several options available to you if you would like blank lines to be kept in source.

  • Respect blank lines {:style :respect-bl}
    This style will perform the formatting done by classic zprint, with the exceptions that any blank lines will be kept intact in the source. You can see several examples here.

  • Respect new lines {:style :respect-nl}
    This style will keep all of the newlines in the source. Both blank lines and all other newlines will be kept. zprint will add newlines as necessary to attempt to fit to the :width, but will never remove a newline even if everything would fit fine in fewer lines. You can see examples of this here.

  • Indent only {:style :indent-only}
    This still will keep all of the newlines in the source, and will never add any new ones. Everything stays on the line it started out on. No width is enforced, because zprint can't do anything about a line that is too long. You can see examples of this here.

You can place an options map like {:style :respect-bl} anywhere an options map is accepted.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close