Skip to content

Commit

Permalink
Preserve whitespace during HTML truncation (fixes code blocks).
Browse files Browse the repository at this point in the history
  • Loading branch information
jgerigmeyer committed May 22, 2023
1 parent 7e186af commit 89a7740
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/helpers/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 89a7740

Please sign in to comment.