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

Automatically detect code language in reading mode for better highlighting #2490

Open
2 tasks done
Ray-D-Song opened this issue Jan 7, 2025 · 4 comments
Open
2 tasks done
Labels
enhancement New feature or request

Comments

@Ray-D-Song
Copy link

Clear and concise description of the problem

In reading mode, mozilla/readability causes the code highlighting effect and language annotation attributes to disappear, but I noticed that shiki still highlights the content. It would be better if the language could be automatically detected before highlighting.

Suggested solution

In the past, I ported guesslang, a library that detects the programming language of source code through deep learning, to run in the browser using TensorFlow.js.
I added the esm format and web worker calls to it and used it in a production environment. You can also refer to this online demo:

https://ray-d-song.github.io/guesslang-js/

Alternative

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • This issue is valid
@Ray-D-Song Ray-D-Song added the enhancement New feature or request label Jan 7, 2025
Copy link

linear bot commented Jan 7, 2025

@PrinOrange
Copy link
Contributor

https://www.npmjs.com/package/@vscode/vscode-languagedetection

@Ray-D-Song
Copy link
Author

Ray-D-Song commented Jan 7, 2025 via email

@Ray-D-Song
Copy link
Author

https://www.npmjs.com/package/@vscode/vscode-languagedetection

At the same time, I believe that applications providing PWA functionality should have some offline capabilities through service workers.

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

No branches or pull requests

2 participants