« Highlight.js » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
(→Build) |
(→Build) |
||
Ligne 9 : | Ligne 9 : | ||
* [http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html#language-names-and-aliases Language names and aliases] | * [http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html#language-names-and-aliases Language names and aliases] | ||
= Build = | = [https://highlightjs.readthedocs.io/en/latest/building-testing.html#building Build] = | ||
<kode lang='bash' ext='svg'> | <kode lang='bash' ext='svg'> | ||
git clone https://github.com/isagalaev/highlight.js | git clone https://github.com/isagalaev/highlight.js |
Version du 29 mai 2022 à 11:00
Liens
- highlight.js
- demo
- developer documentation
- GitHub
- Language contributor checklist
- Language names and aliases
Build
git clone https://github.com/isagalaev/highlight.js cd highlight.js/ # installation des dépendances dans ./node_modules # npm i utilise le fichier package.json npm i # création du dossier build et de ses fichiers node tools/build.js -t browser -n :common csharp cpp # -t browser, target (browser, cdn, node, all) # -n, Disable compression # :common, langages de base # csharp cpp, les langages c# et c++ |
Test
Après avoir buildé
- build/demo/index.html
- tools/developer.html
Ajouter un nouveau langage
test/detect/[nouveau langage]/default.txt |
Code de démo |
src/languages/[nouveau langage].js |
/* Language: [nouveau langage] Author: Moi <moi@domaine.fr> Category: common */ function(hljs) { var KEYWORDS = { keyword: 'abc def', literal: 'null false true' }; return { aliases: ['aaa'], keywords: KEYWORDS, illegal: /::/, contains: [ hljs.COMMENT( '//', // tout ce qui commence par // '$' // jusqu'à la fin de la ligne ), ] }; } |
Category
assembler | common | config | css |
enterprise | functional | graphics | lisp |
markup | protocols | scientific | scripting |
system | template |
Installation
npm install -g highlight.js # highlight.js → /usr/lib/node_modules/highlight.js/lib/ # languages → /usr/lib/node_modules/highlight.js/lib/languages # css → /usr/lib/node_modules/highlight.js/styles/ |