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 a98c8f7 + e732736 commit 5c633f6
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 5c633f6

Please sign in to comment.