-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat: Support hide lines in remark-embed-snippet #6084
feat: Support hide lines in remark-embed-snippet #6084
Conversation
it(`should support hideline-range markers`, () => { | ||
fs.readFileSync.mockReturnValue( | ||
` | ||
// hideline-range{1-2, 9-11, 16} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The white space after the comma should be removed to keep consistency.
Can you add a test case where |
Deploy preview for gatsbygram ready! Built with commit 7324d39 |
Deploy preview for using-drupal ready! Built with commit 7324d39 |
I'm actually not quite sure about the expected behavior in the first place when we have both Let's check with @bvaughn |
@cyan33 I do not know if I understand correctly, but I believe the number of hidden lines should not influence the highlight line setting. For example: // hideline-range{1-3}
// highlight-range{4-8} -
import React from "react"
import ReactDOM from "react-dom"
function App() {
return (
<h1>Hello world!</h1>
)
} Lines 1 to 3 will be hidden, so we could think of writing |
@washingtonsoares Agree. I've read the changes. Looks good to me. 👍 |
``` | ||
|
||
Will produce something like this: | ||
![screenshot from 2018-06-21 20-21-58](https://user-images.githubusercontent.com/5726140/41750161-cdf430cc-7590-11e8-9ccb-8829bcce0f14.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't this url expire after some time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pieh! 🙂
I did not know that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also not aware of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this was just question, not a statement - sorry for confusion here!
I think the expected behavior when highlight and hide lines overlap is ambiguous, and we should error if the ranges ever intersect. |
@bvaughn I got it and come to think of it, it seems to make sense. However in this case it is better to |
I think it's better to error. |
const hasIntersection = isHiddenLine && isHighlightedLine | ||
|
||
if (hasIntersection) { | ||
throw `There can be no intersection between hidden lines and highlighted lines` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we display path to file that is offender here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like a good idea.
const hasIntersection = isHiddenLine && isHighlightedLine | ||
|
||
if (hasIntersection) { | ||
throw Error(`There can be no intersection between hidden lines and highlighted lines - "${path}"`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about The range number of hide-lines and highlight-lines cannot be intersected. Check the file: ${path}.
I have question about DX - does this terminate both |
I feel like this is good to be merged now - is there anything else to do here? |
LGTM as well. |
Deploy preview for using-postcss-sass failed. Built with commit 7324d39 https://app.netlify.com/sites/using-postcss-sass/deploys/5b57b5b03813f0336b68bb8a |
For a more detailed explanation of this improvement, refer to the README.
This PR adds the ability to define rows to be hidden.
Given a file like this (eg examples/hello-world.js):
Will generate a code like this:
This PR is related to PR #5619 and ReactJS.org PR reactjs/react.dev/pull/913
cc @cyan33