-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Code snippet details renderer type #6901
Comments
I like this look, I definitely agree that a 1 column table would look odd. Definitely like the look of a full width code-snippet list. I feel like this could be an Does each snippet contain the full JSON-LD file for expansion? Should it be a fixed # of lines, I don't see why we would need to include an expansion on each snippet as long as we would preserve the overall global line numberings. Just like the +/- 2 lines from the error. @hwikyounglee thoughts on the look and feel? Stylistically I might want the gray outlines to go away to match the full width tables' style. |
Yeah. If the JSON can be parsed we show a prettified version of the snippet. There are two goals here:
Usually the snippet will be less than 20 lines long, so it won't affect the result size too much. Beyond that we can truncate it. Just in case someone finds it helpful, here are some more examples of what the item type looks like. |
@rviscomi brought up linking the JSON-LD item to the node in the DevTools elements panel. The linking works by looking for Do we want the UI to look something like this? |
The DT code already uses Or are you suggesting the DT code just looks for any element (not just |
Yeah. Not sure what the final UI will be for the JSON-LD snippets, but I feel it'd be better to avoid |
Current status Got some design feedback from @hwikyounglee https://jsonld-display.glitch.me/#seo Limiting snippet size I started truncating the snippets, currently storing 20 lines around each highlight, with a max line length of 200. New details renderer data:
Linking to elements panel Going to put this next to the title, but only show it in DevTools. Will just use |
Thanks Hwi!
If the message appears below a specific line it feels like it belongs to that particular line, even though all lines are highlighted. I'd prefer keeping error messages that don't belong to a particular line at the top.
I've partially implemented this. If the code itself is scrollable the error text still scrolls, will see if I find a clean way to prevent that in CSS.
That would be nice to have 95% of the time, but it's tricky to get right. If we just put a line break after each comma we'd also put line breaks in the middle of strings that contain commas, and the user might think those line breaks are why the JSON is invalid. Given that the JSON is invalid I don't think we can find a 100% safe way to prettify it. What would be helpful here is a column index for the error or a better error message. I'll check with @rviscomi, but got the feeling that'll be lower priority. Btw, it'll only be single line if the JSON is invalid and it's single line in the page HTML. |
Got it! Thanks for ramping me up on all these points. Thanks Matt! |
We're building this primarily for JSON-LD validation results, but are hoping to re-use it elsewhere eventually.
The type looks like this:
Two rendered items:
Putting the
code-snippet
items into a single-column table looks bad. I'm planning to create another item typecode-snippet-list
to render them. Does that sound reasonable?I guess it could also be called
lh-list
since it's really just a list with padding between items.Not sure if we'd ever want it to be part of a table – here's how that would look like right now.
What do you think about how to structure the item types here?
The text was updated successfully, but these errors were encountered: