Preserve whitespace during HTML truncation (fixes code blocks).

This commit is contained in:
Jonny Gerig Meyer 2023-05-22 13:13:27 -04:00
parent a3f0ea2af5
commit f21dd48def
No known key found for this signature in database

View File

@ -32,7 +32,7 @@ export const getLorem = (type: string, number = 1) => {
* @see https://github.com/oe/truncate-html
*/
export const truncateHTML = (html: string, words = 170) =>
truncate(html, words, { byWords: true });
truncate(html, words, { byWords: true, keepWhitespaces: true });
/**
* Renders block of Markdown into HTML.