-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rehype-minify-whitespace: inline HTML content is trimmed #19
Comments
If someone wants to work on it, it’s in Moved from remarkjs/remark#275. |
@wooorm I'm not using rehype-minify-whitespace in that repro - are you certain that's the problem? |
@wooorm seems like the best approach may be to simply allow whitespace minification to be toggled off in the options for rehype-remark/hast-util-to-mdast. Would you accept a PR for that? |
Just dropping this here ’cause it probably has to be something like this: https://github.com/wooorm/remark-lint/blob/master/packages/remark-lint-no-paragraph-content-indent/index.js |
Bumping this as we're still experiencing this issue: decaporg/decap-cms#3727 I added a test that is failing erezrokah@d7cc409#diff-c7e2175747a03e137c1615aecfaa1636R103 but not sure how to go about fixing it. Can you suggest a place to get started? |
I am facing the same issue. It is coming from those lines: I think the problem is that in the case of a |
Re-thinking about it, I would even argue you should never trim an inline element: there is no way you can know if the leading / trailing space has been introduced on purpose or not:
|
Released! |
This is amazing @wooorm, do you suggest I open PRs for https://github.com/syntax-tree/hast-util-to-mdast/blob/7c4667743dd056b33f1c76a7c319674aef951a4f/package.json#L40 and https://github.com/rehypejs/rehype-remark/blob/10c28f586be34b1baf3d221d8116a7e70aed2365/package.json#L28 to update dependencies? |
It's a patch, so reinstalling dependencies should do the trick! |
Sorry, let me clarify my question. I'm using (with "resolutions": {
"rehype-minify-whitespace": "^4.0.2"
} But that is not ideal UpdateMy workaround doesn't work - investigating |
Awesome! Thanks a lot @wooorm. I tried to test the changes (I manually patched
I traced to https://github.com/syntax-tree/hast-util-to-mdast/blob/master/index.js#L31 : |
@wooorm You removed the 64c6206#diff-a6b748a472d9e6a0024e05443221d898L44 Adding it here fix the issue: https://github.com/rehypejs/rehype-minify/blob/master/packages/rehype-minify-whitespace/index.js#L40 |
Created a PR to address this new issue: #33 I tested the new trimming behaviors, works pretty well, especially with "my" complex DOM. Thanks again! |
The contents of inline tags are being trimmed. When parsing html to markdown:
Input
Expected output
Actual output
Runkit repro: https://runkit.com/erquhart/595d36c4e60f6b0012c00405
The text was updated successfully, but these errors were encountered: