brandonbloom / fipp

Fast Idiomatic Pretty Printer for Clojure
525 stars 44 forks source link

add :escaped node type #23

Closed scgilardi closed 9 years ago

scgilardi commented 9 years ago

from the commit:

an escaped node prints its single argument verbatim but measures it as only one character. this is useful for allowing multi-character escape sequences in the printed output to represent a single character. For example, html entities such as """ or "&".

Thanks for the great work! I needed something between :pass and :text while working on extending puget to use HTML markup for colorizing. Please consider this pull request to add :escaped.

brandonbloom commented 9 years ago

LGTM, thanks!

Makes me wonder if there would have been a better primitive that could cover all three use cases, but it seems it's too late for that now.

brandonbloom commented 9 years ago

Deployed v0.5.2 with this new feature.

scgilardi commented 9 years ago

Thanks! Yes, a "print like this string", "contribute this width" primitive might have been nice. It could even be done as an enhancement to :text but some code may already be depending on its (apply str text) behavior. I think the names and semantics of the current crop of nodes are pretty good though.

Thanks very much for the quick turnaround on the merge and release!