Skip to content
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

fix(mmkv): Add success-lines to the MMKV recipe so the diffs are easier to grok #139

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

markrickert
Copy link
Member

This just makes things a little easier to read on which lines need to be added and deleted.

Before:

Screenshot 2024-02-28 at 12 17 58 PM

Now:

Screenshot 2024-02-28 at 12 18 31 PM

@lindboe
Copy link
Contributor

lindboe commented Feb 28, 2024

Interesting! This looks good, other notes on diffing in cookbook to follow, engage if you want...

I didn't know this was an option for highlighting text in a diff-y way. Other recipes are using diff as the language on their code blocks. I do think, while this magic comment system is a bit unexpected, the end result is a little nicer-looking.

I went looking to see if we could extend prism at all to make diff-styling easier, but it looks like there's problems around including the plugin meant for that (diff-highlight), i.e., here: https://docusaurus.io/feature-requests/p/include-prism-diff-highlight. With enough effort, surely we can, but idk if it's worth it.

I do think it would be good to help this stay consistent; maybe we can make a style guide doc, or a linter, or add a VS code snippet to auto-generate the right comment where it's needed?

@markrickert markrickert merged commit dc7de18 into main Feb 29, 2024
1 check passed
@markrickert markrickert deleted the mrickert/mmkv-fixes branch February 29, 2024 15:04
@markrickert
Copy link
Member Author

Yeah, i noticed the // error-line comments were red, but then we were missing green lines for additions!

I actually like specifying the language and then adding these "magic comments" over styling it as a diff with the +/- directly in the code block.

@frankcalise
Copy link
Contributor

Yeah the diff for me is less copy/pastable as well, cause then you have to shed the +/- versus easily grabbing the line.

We could maybe supply a patch snippet that is collapsed at times if we wanted to cover both

@lindboe
Copy link
Contributor

lindboe commented Feb 29, 2024

We could maybe supply a patch snippet that is collapsed at times if we wanted to cover both

@frankcalise can you elaborate on this idea? I'm not sure what that would entail. Cover both using the red/green highlight so it's copy-pastable, and the +/- in separate use cases? (I'm personally fine with dropping the +/- for copy-pastability)

@frankcalise
Copy link
Contributor

frankcalise commented Feb 29, 2024

@lindboe Cool that works for me. I was just mentioning that if you wanted the diff as well (sounds like you don't necessarily, so I misunderstood), we could provide it in a collapsed panel as well so it didn't just keep lengthening the recipes.

There's an example of it (although used for snippets and other visuals) in the vision camera and select field reviews recipes.

Collapsed

image

Expanded

image

@lindboe
Copy link
Contributor

lindboe commented Feb 29, 2024

What I personally like is having a simple and expected way to render a diff-like-thing with highlighting. I felt +/- are easy ways to notate that and that's why the diff-highlighter plugin would be nice, but I don't need them to show up in the end result, as long as it's easy to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants