Skip to content

Commit

Permalink
Merge pull request sass#48 from oddbird/hotfix-truncation
Browse files Browse the repository at this point in the history
Preserve whitespace during HTML truncation (fixes code blocks).
  • Loading branch information
jgerigmeyer committed May 22, 2023
2 parents 7e186af + 89a7740 commit 4272b95
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 4272b95

Please sign in to comment.