Add formatBlockQuote utility and blockquote nunjucks filter so both default and custom template exports prefix every line with `>`. Document all available formatters in the custom template help panel. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -213,6 +213,22 @@ env.addFilter('nl2br', (value: string) => {
|
||||
return value.replace(/\n/g, '<br>\n');
|
||||
});
|
||||
|
||||
/**
|
||||
* Formats text as a markdown block quote, prefixing every line with `> `.
|
||||
*/
|
||||
export function formatBlockQuote(text: string): string {
|
||||
return text
|
||||
.split('\n')
|
||||
.map((line) => `> ${line}`)
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
// Add 'blockquote' filter (prefix every line with > for markdown block quotes)
|
||||
env.addFilter('blockquote', (value: string) => {
|
||||
if (!value || typeof value !== 'string') return '';
|
||||
return formatBlockQuote(value);
|
||||
});
|
||||
|
||||
/**
|
||||
* Renders a Jinja2/Nunjucks template with the given data
|
||||
* @param template The template string in Jinja2/Nunjucks syntax
|
||||
|
||||
Reference in New Issue
Block a user