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: CodeBlock fixes (select menu, bundled languages, paste from VS Code) #1219

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

areknawo
Copy link
Contributor

@areknawo areknawo commented Nov 6, 2024

Fixes CodeBlock issues:

Improves on the #1213, fixing duplicate languages in the bundle output (by importing from only a single Shiki bundle);

Copy link

vercel bot commented Nov 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote 🛑 Canceled (Inspect) Nov 14, 2024 0:44am
blocknote-website ✅ Ready (Inspect) Visit Preview Nov 14, 2024 0:44am

Copy link

vercel bot commented Nov 6, 2024

@areknawo is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@sindras sindras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: thank you for improving this!

# Conflicts:
#	package-lock.json
@YousefED YousefED mentioned this pull request Nov 14, 2024
Copy link
Collaborator

@YousefED YousefED left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the delay, we'll get this merged this week!

@areknawo I pushed some minor suggestions from @matthewlipski, and only have 1 question re. the correct bundle to import (web or default)

@@ -1,4 +1,4 @@
import { bundledLanguagesInfo } from "shiki/bundle/web";
import { bundledLanguagesInfo } from "shiki";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@areknawo if we're selecting 1 bundle, doesn't it make more sense to only use "shiki/bundle/web"; to bring down size at least a little?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YousefED Not sure if it'd work. bundledLanguagesInfo is used to verify if specific language ID can be loaded. If it was limited to languages from the web bundle, languages outside of it wouldn't work.

Apart from the check, it might also affect bundling. Importing the full package, all languages are included in the bundle and you can customize which one you choose to support (and externalize others from the bundle). If it was limited to the web bundle, I'm not sure if other language would work at all.

Copy link
Collaborator

@YousefED YousefED Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're fine with only supporting languages from the web bundle we can limit to shiki/bundle/web right? I think that's ok for now until we get requests for more esoteric languages.,

Also, I'm thinking we might want to shift to forcing users to pass in languages explicitly; while that would not disable syntax highlighting by default, I think it's also important to have a cleaner packaging / bundling experience

Copy link
Contributor Author

@areknawo areknawo Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case - yes. Worth noting though that the current defaults include a few languages outside the web bundle.

As for the latter - I agree that switching to explicit imports would make sense. The only drawback would be more difficult customization and a question of balance between built-in defaults and languages you have to import (in that case, maybe it makes sense to remove the defaults completely?)

@vercel vercel bot temporarily deployed to Preview – blocknote November 14, 2024 12:44 Inactive
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.

4 participants