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

feature (content): Using Shiki Transformers #1690

Closed
rishi-raj-jain opened this issue May 16, 2024 · 14 comments
Closed

feature (content): Using Shiki Transformers #1690

rishi-raj-jain opened this issue May 16, 2024 · 14 comments

Comments

@rishi-raj-jain
Copy link
Contributor

Currently, Shiki is integrated into the system (which is awesome), but highlighting a particular line as insertion and deletion with specific colors is missing. It's a good to have.

@rishi-raj-jain
Copy link
Contributor Author

Being addressed in #1724.

@saimonkat
Copy link
Collaborator

saimonkat commented May 31, 2024

@rishi-raj-jain JS implementation looks good and according the shiki transformers docs 👏

Regarding CSS I'd like to:

  • move it up to the @layer components
  • adjust scss classes
  • add before items as + and
  • update colors for dark theme support
.has-diff code .line {
  @apply pl-6;

  &.diff {
    &.add {
      @apply bg-code-green-1/10 before:absolute before:left-2 before:text-code-green-1 before:content-['+'];
    }
    &.remove {
      @apply bg-code-red-1/10 before:absolute before:left-2 before:text-code-red-1/50 before:content-['—'];
    }
  }
}

image

image

@saimonkat
Copy link
Collaborator

saimonkat commented May 31, 2024

@rishi-raj-jain I also noticed that we need to update our copy button with styles and functionality in case of transformers.

Styles

It's good for dark theme
image

But has a lack of background for light theme
image

Functionality
According the functionality on original shiki transformers page, copy button shouldn't copy removed lines of code. I guess we need to improve it in the same way

If you want me, I can help you with this, uploading my commit

@rishi-raj-jain
Copy link
Contributor Author

@saimonkat

Appreciate your detailed review.

Yes, it'd be great to have help from you!

@rishi-raj-jain
Copy link
Contributor Author

Would you be open to committing the changes as you suggested earlier as well? I'm happy to as well.

@saimonkat
Copy link
Collaborator

@rishi-raj-jain ok sure, I'll commit my updates now.

Copy button would take extra time by the way, but I'll work on this too.

@rishi-raj-jain
Copy link
Contributor Author

Thank you, @saimonkat!

@saimonkat
Copy link
Collaborator

saimonkat commented May 31, 2024

@rishi-raj-jain updated styles for highlighting and fix for copy button in #1724.

There is only one bug left, removed line of code provides empty line in result of copying:

image

Hope you could help me to take a look at this commit 8b55b94

@rishi-raj-jain
Copy link
Contributor Author

Taking a look now!

@rishi-raj-jain
Copy link
Contributor Author

Added a fix, please review @saimonkat.

@saimonkat
Copy link
Collaborator

@rishi-raj-jain Thanks! I'm not home now, but overall looks like a good fix overall by the code 🔥 I'll review closer when I'm back home

@saimonkat
Copy link
Collaborator

Hey @rishi-raj-jain your fix looks really good and works good as well, thank you!

I just optimized it a little bit and I think we're ready!

@rishi-raj-jain
Copy link
Contributor Author

@saimonkat Thank you!

I've simplified it even further: 92f6c2e.

Feel free to drop an approving review for it.

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

No branches or pull requests

2 participants