Skip to content

Commit

Permalink
Add padding to embedded elements
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 19, 2018
1 parent 108c177 commit 63e9e70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var minify = require('rehype-minify-whitespace')({newlines: true})
var phrasing = require('hast-util-phrasing')
var embedded = require('hast-util-embedded')
var sensitive = require('html-whitespace-sensitive-tag-names')
var repeat = require('repeat-string')
var visit = require('unist-util-visit-parents')
Expand Down Expand Up @@ -124,7 +125,9 @@ function padding(node, head) {
}

if (node.type === 'element') {
return node.tagName === 'script' || !phrasing(node) || head
return (
head || node.tagName === 'script' || embedded(node) || !phrasing(node)
)
}

return false
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"index.js"
],
"dependencies": {
"hast-util-embedded": "^1.0.1",
"hast-util-phrasing": "^1.0.0",
"html-whitespace-sensitive-tag-names": "^1.0.0",
"rehype-minify-whitespace": "^2.0.0",
Expand Down

0 comments on commit 63e9e70

Please sign in to comment.