Skip to content

feat: support langalias #68

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

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

Conversation

juliusmarminge
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Jun 12, 2025

⚠️ No Changeset found

Latest commit: df9c79d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jun 12, 2025

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

Name Status Preview Comments Updated (UTC)
react-shiki ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2025 0:15am

@@ -24,11 +24,5 @@
"changesets-changelog-clean": "^1.3.0",
"typescript": "^5.8.2"
},
"packageManager": "pnpm@10.4.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

got some errors trying to install this version with checksums so updated it

Comment on lines -28 to -33
"pnpm": {
"onlyBuiltDependencies": [
"@biomejs/biome",
"esbuild"
]
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these options can now live in pnpm-workspace in case you're wondering where they went 😅

@AVGVSTVS96
Copy link
Owner

Thanks for the PR! This looks good so far, but we need to pass langAlias through to the highlighter factories:

  • Add langAlias param to createHighlighter signature and pass it to the factory in hook.ts
  • Add langAlias param and pass to getSingletonHighlighter in bundles/full.ts & bundles/web.ts

Should be fully functional with these changes :)

code,
language: 'golang',
langAlias: {
golang: 'go',
Copy link
Owner

Choose a reason for hiding this comment

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

Isn’t go recognized as an alias for golang by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope

Copy link
Owner

Choose a reason for hiding this comment

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

Actually it looks like go is the primary identifier for golang in shiki - https://shiki.style/languages. Does golang work as an identifier for go? I don't think it would judging by go.json in shiki-textmate-themes-grammars repo, but can't test at the moment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Our usecase for this was that LLMs sometimes output \``golang` headers for codeblocks and those weren't getting formatted. The alias here just makes it so golang gets passed to the go language spec

() =>
resolveLanguage(
stableLang,
stableOpts.customLanguages as never,
Copy link
Owner

Choose a reason for hiding this comment

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

why cast as never?

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.

2 participants