# returns unwrapped input if it’s short enough - input: ‘Etiquette’ by Sir William Schwenck Gilbert output: ‘Etiquette’ by Sir William Schwenck Gilbert # wraps short input if requested to wrap it shorter, avoiding hangouts - width: 16 input: ‘Etiquette’ by Sir William Schwenck Gilbert output: |- ‘Etiquette’ by Sir William Schwenck Gilbert # wraps long input to 72 characters by default, targetting similar line length - input: The Ballyshannon foundered off the coast of Cariboo, And down in fathoms many went the captain and the crew; output: |- The Ballyshannon foundered off the coast of Cariboo, And down in fathoms many went the captain and the crew; # rewraps multiline paragraphs - input: |- Down went the owners — greedy men whom hope of gain allured: Oh, dry the starting tear, for they were heavily insured. output: |- Down went the owners — greedy men whom hope of gain allured: Oh, dry the starting tear, for they were heavily insured. # wrapped paragraphs are as short as possible - input: |- Besides the captain and the mate, the owners and the crew, The passengers were also drowned, excepting only two: Young PETER GRAY, who tasted teas for BAKER, CROOP, AND CO., And SOMERS, who from Eastern shores imported indigo. output: |- Besides the captain and the mate, the owners and the crew, The passengers were also drowned, excepting only two: Young PETER GRAY, who tasted teas for BAKER, CROOP, AND CO., And SOMERS, who from Eastern shores imported indigo. # one-letter words are not left at line ends - width: 39 input: |- These passengers, by reason of their clinging to a mast, Upon a desert island were eventually cast. They hunted for their meals, as ALEXANDER SELKIRK used, But they couldn’t chat together — they had not been introduced. output: |- These passengers, by reason of their clinging to a mast, Upon a desert island were eventually cast. They hunted for their meals, as ALEXANDER SELKIRK used, But they couldn’t chat together — they had not been introduced. # multiple paragraphs are wrapped independently - input: |- For PETER GRAY, and SOMERS too, though certainly in trade, Were properly particular about the friends they made; And somehow thus they settled it without a word of mouth — That GRAY should take the northern half while SOMERS took the south. On PETER’S portion oysters grew — a delicacy rare, But oysters were a delicacy PETER couldn’t bear. On SOMERS’ side was turtle, on the shingle lying thick, Which SOMERS couldn’t eat, because it always made him sick. output: |- For PETER GRAY, and SOMERS too, though certainly in trade, Were properly particular about the friends they made; And somehow thus they settled it without a word of mouth — That GRAY should take the northern half while SOMERS took the south. On PETER’S portion oysters grew — a delicacy rare, But oysters were a delicacy PETER couldn’t bear. On SOMERS’ side was turtle, on the shingle lying thick, Which SOMERS couldn’t eat, because it always made him sick. # email-quoted paragraphs are wrapped regardless of quotes - input: |- > On PETER’S portion oysters grew — a delicacy rare, > But oysters were a delicacy PETER couldn’t bear. > On SOMERS’ side was turtle, on the shingle lying thick, > Which SOMERS couldn’t eat, because it always made him sick. output: |- > On PETER’S portion oysters grew — a delicacy rare, But > oysters were a delicacy PETER couldn’t bear. On SOMERS’ > side was turtle, on the shingle lying thick, Which > SOMERS couldn’t eat, because it always made him sick. # email quotes can be of any depth - input: |- >> GRAY gnashed his teeth with envy as he saw a mighty store >> Of turtle unmolested on his fellow-creature’s shore: >> The oysters at his feet aside impatiently he shoved, >> For turtle and his mother were the only things he loved. output: |- >> GRAY gnashed his teeth with envy as he saw a mighty store >> Of turtle unmolested on his fellow-creature’s shore: >> The oysters at his feet aside impatiently he shoved, >> For turtle and his mother were the only things he loved. # email quotes are normalised upon wrapping - input: |- > > >And SOMERS sighed in sorrow as he settled in the south, > > >For the thought of PETER’S oysters brought the water to his mouth. > > >He longed to lay him down upon the shelly bed, and stuff: > > >He had often eaten oysters, but had never had enough. output: |- >>> And SOMERS sighed in sorrow as he settled in the south, For >>> the thought of PETER’S oysters brought the water to his mouth. >>> He longed to lay him down upon the shelly bed, and stuff: >>> He had often eaten oysters, but had never had enough. # quoted paragraph breaks are cleared - input: |- >> How they wished an introduction to each other they had had >> When on board The Ballyshannon! And it drove them nearly mad >> To think how very friendly with each other they might get, >> If it wasn’t for the arbitrary rule of etiquette! > > One day, when out a-hunting for the mus ridiculus, > GRAY overheard his fellow-man soliloquising thus: > ‘I wonder how the playmates of my youth are getting on, > MCCONNELL, S. B. WALTERS, PADDY BYLES, and ROBINSON?’ output: |- >> How they wished an introduction to each other they had had >> When on board The Ballyshannon! And it drove them nearly >> mad To think how very friendly with each other they might >> get, If it wasn’t for the arbitrary rule of etiquette! > One day, when out a-hunting for the mus ridiculus, GRAY overheard his > fellow-man soliloquising thus: ‘I wonder how the playmates of my youth > are getting on, MCCONNELL, S. B. WALTERS, PADDY BYLES, and ROBINSON?’ # code comments are handled like email-quoted text - input: |- // These simple words made PETER as delighted as could be, // Old chummies at the Charterhouse were ROBINSON and he! // He walked straight up to SOMERS, then he turned extremely red, // Hesitated, hummed and hawed a bit, then cleared his throat, and said: // # ‘I beg your pardon—pray forgive me if I seem too bold, # But you have breathed a name I knew familiarly of old. # You spoke aloud of ROBINSON – I happened to be by— # You know him?’ ‘Yes, extremely well.’ ‘Allow me – so do I!’ # It was enough: they felt they could more sociably get on, For (ah, the magic of the fact!) they each knew ROBINSON! And MR. SOMERS’ turtle was at PETER’S service quite, And MR. SOMERS punished PETER’S oyster-beds all night. output: |- // These simple words made PETER as delighted as could be, Old chummies // at the Charterhouse were ROBINSON and he! He walked straight // up to SOMERS, then he turned extremely red, Hesitated, // hummed and hawed a bit, then cleared his throat, and said: # ‘I beg your pardon—pray forgive me if I seem too bold, # But you have breathed a name I knew familiarly of old. # You spoke aloud of ROBINSON – I happened to be by— You # know him?’ ‘Yes, extremely well.’ ‘Allow me – so do I!’ It was enough: they felt they could more sociably get on, For (ah, the magic of the fact!) they each knew ROBINSON! And MR. SOMERS’ turtle was at PETER’S service quite, And MR. SOMERS punished PETER’S oyster-beds all night.