charmbracelet / glamour

Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️
MIT License
2.49k stars 182 forks source link

Prefix on multi-lined blockquotes #6

Closed meowgorithm closed 4 years ago

meowgorithm commented 4 years ago

As a warning, I understand what I'm about to outline is expected behavior; this a proposal for an exception for blockquotes.

A multiline block will only render the prefix at the beginning of the first line. For example, this input…

> Down dropt the breeze, the sails dropt down,                                                      
> ’Twas sad as sad could be;                                                                        
> And we did speak only to break                                                                    
> An artichoke in the sea!

Renders to…

> Down dropt the breeze, the sails dropt down,                                                      
’Twas sad as sad could be;                                                                        
And we did speak only to break                                                                    
An artichoke in the sea! 

When all the text is on one line we get similar output. This…

> The artichoke is mentioned as a garden plant in the 8th century BC by Homer and Hesiod. The naturally occurring variant of the artichoke, the cardoon…

…renders to…

> The artichoke is mentioned as a garden plant in the 8th century BC by Homer and
Hesiod. The naturally occurring variant of the artichoke, the cardoon…

If we changed the behavior so the prefix was applied to every line, we could get nice effects like:

│  Down dropt the breeze, the sails dropt down,                                                      
│  ’Twas sad as sad could be;                                                                        
│  And we did speak only to break                                                                    
│  An artichoke in the sea!

Alternatively, we could use prefix/suffix to do things surround quotes with and , but at the moment suffix is rendered on a new line. I suspect the more popular and useful behavior would be a prefix before every line.

muesli commented 4 years ago

You can now specify an indent_token for block elements, which lets you do exactly that. I've updated the default styles to make use of that feature for blockquotes.