This article is a mirror article of machine translation, please click here to jump to the original article.

View: 1477|Reply: 1

[Other] The prismjs code highlighting plugin introduces the issue of all language orders

[Copy link]
Posted on 2025-3-2 20:13:24 | | | |
Requirements: Front-end projects use prismjs to highlight and color the code, all 297 languages supported by prismjs, if you want to introduce all programming languages, there is a dependency problem, that is, there is an introduction order.

Prism is a lightweight, extensible syntax highlighter built with modern web standards in mind. It is used by millions of websites, including some that you visit every day.

Official Website:https://prismjs.com/
Source:https://github.com/PrismJS/prism

If there is a dependency problem with the introduced programming language, the error is as follows:

Uncaught TypeError: Cannot set properties of undefined (setting 'keyword')
    at Object.extend (scripts.js:345:14)
    at scripts.js:1949:41

Prism.languages.arduino=Prism.languages.extend("cpp",{});


Dependency viewingrequirefields, view:The hyperlink login is visible.

If you are using the specified version of the npm installation, you can check it"node_modules\prismjs\components.js"Disposition.

solution

Implement dependency sorting yourself, the code is as follows:






Previous:[AI] (8) Introduction to the dialogue roles system, user, and assistant of large models
Next:Fuse.js Front-end lightweight fuzzy search library (full-text search)
 Landlord| Posted on 2025-3-2 20:20:43 |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com