Open jeremie-diarra opened 1 year ago
Ping @romoez & @TheLime1
sorry i dont know how to transfer the code to a highlight.js function but i asked ChatGPT !
Here is an example of what your hljs.registerLanguage() function might look like:
hljs.registerLanguage('my-language', function(hljs) {
var keywords = 'if else while for ...'; // list of keywords in your language
var builtins = 'print input ...'; // list of built-in functions in your language
return {
name: 'My Language', // name of your language
case_insensitive: true, // whether your language is case-insensitive
keywords: {
keyword: keywords,
built_in: builtins
},
contains: [
{
className: 'string',
begin: "'", end: "'",
contains: [hljs.BACKSLASH_ESCAPE]
},
{
className: 'string',
begin: '"', end: '"',
contains: [hljs.BACKSLASH_ESCAPE]
},
{
className: 'number',
begin: '\\b\\d+(\\.\\d+)?',
relevance: 0
},
// more syntax rules here
]
};
});
@jeremie-diarra
thanks mate, will try this :pray:
This "Algorithme en Pseudocode" is exactly the (french) pseudo code language I was looking for, so, first of all, thank you so much for this 🙏
I'm also a big fan of highlight.js, and I'm looking for a way to highlight french pseudo code on a web page. And I'm wondering if you guys got some clues on this ?
Thanks again for the great great extension, so helpful to bring life to code with the students !