Getting the right mode file

I’m working on a file manager and need a way to configure the modes in the admin control panel. I have a textarea for the setting and so far my plan is to have the user configure as shown:

css   {"name":"css"}                    css
html  {"name":"htmlmixed"}              html,htm,mustache
js    {"name":"javascript"}             js
php   {"name":"php"}                    php
sql   {"name":"sql"}                    sql
xml   {"name":"xml"}                    xml

C     {"name":"clike"}                  c,h,cpp,hpp
json  {"name":"javascript","json":true} json

PHP will preg_split the setting into appropriate arrays on line breaks and spaces. The first column is the textContent that will show in the mode selector, the second the mode value, the third a list of file extensions that will automatically set the mode.

But now I need to get the right mode file for each mode, so here’s my question: Will it always work to use the name in the object in the second column for the folder and file name? I’m planning on using RequireJS to get the dependent files

By the way, I know nothing about the various C languages so I’m not sure the second to last line would be correct, I show it only to illustrate the concept.

The modes in the distribution follow the mode/NAME/NAME.js naming style, where NAME matches the name field in the mode spec.

See also mode/meta.js for a pre-defined table of modes and file extensions.

Okay, thanks. I’ll have users check that table (or maybe copy and json_encode it on the server)

How could I combine json and json-ld on a single setting on the mode selector, or is that even possible?

from bottom of javascript.js:

CodeMirror.defineMIME("text/javascript", "javascript");
CodeMirror.defineMIME("text/ecmascript", "javascript");
CodeMirror.defineMIME("application/javascript", "javascript");
CodeMirror.defineMIME("application/x-javascript", "javascript");
CodeMirror.defineMIME("application/ecmascript", "javascript");
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true

from mode/meta.js

{name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]},
{name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]},

And what is “alias” in mode/meta.js?