Skip to content

Cannot load extra languages on 11.3.0 #3363

@JoshyPHP

Description

@JoshyPHP

I'm trying out 11.3.0 and it seems impossible to load any extra language. Here's my full test page, complete with all of the boilerplate code:

<!DOCTYPE html>
<html lang="en">
<head>
	<title>hljs</title>
	<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css">
	<script src="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
	<script src="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/languages/erlang.min.js"></script>
</head>
<body>
	<pre><code class="language-erlang">-module(hello).
-export([hello_world/0]).

hello_world() -> io:fwrite("hello, world\n").</code></pre>
<script>hljs.highlightAll();</script>
</body>
</html>

Here's the error I get in Chromium's console: (the same error is triggered on Firefox)

Uncaught TypeError: Cannot assign to read only property 'name' of function 'e=>{
const n="[a-z'][a-zA-Z0-9_']*",r="("+n+":"+n+"|"+n+")",a={
keyword:"after and andalso|10 band begin bnot b...<omitted>...}}'
    at Object.registerLanguage (highlight.min.js:290)
    at erlang.min.js:1

As far as I can tell, this is because the closure passed to registerLanguage in order to register new languages currently returns another closure whereas registerLanguage expects an object with a name property. This happens with erlang and smalltalk but I suppose it's the same thing for all the languages. I've only tried the files hosted on CDN, not sure whether it makes a difference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions