Skip to content

Commit

Permalink
fix: don't remove space before style attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin committed Jan 14, 2024
1 parent 0c33efa commit 5e923b3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/transformers/prettify.js
Expand Up @@ -33,7 +33,8 @@ const reFormat = (html, config) => {
return html
.replace(/,\s*/g, ', ')
.replace(/(\s+style="\s+)([\s\S]*?)(\s+")/g, (match, p1, p2, p3) => {
const formattedStyle = p2.replace(/\s+/g, ' ').trim()
return p1.trim() + formattedStyle + p3.trim()
return p1.replace(/\n\s+?(style)/g, ' $1').trimEnd()
+ p2.replace(/\s+/g, ' ').trim()
+ p3.trim()
})
}

0 comments on commit 5e923b3

Please sign in to comment.