HTML `matchCLosingTags`: Configure language when loading with language-data pack

Are there any ways to configure a language extension when it’s being loaded using the language-data pack?

Looking at language-data/language-data.ts at main · codemirror/language-data · GitHub it doesn’t look like the load() function for the languages pass through configuration.

Ultimately, I’m looking to enable/disable matchClosingTags and autoCloseTags for HTML. Those are enabled by default, but I’d like users to be able to disable that if they want.

No, the language description objects in that package provide just the default configuration. But you can add additional custom language descriptions to the start of the array of desrciptions that you actually use to override some, if you need to.

Thanks for the response.

Is html the only one in language-data that implements matchClosingTags⁠ and autoCloseTags⁠ via config?

A nice enhancement would be to allow the load functions in language-data to pass in config options:

  LanguageDescription.of({
    name: "HTML",
    alias: ["xhtml"],
    extensions: ["html", "htm", "handlebars", "hbs"],
    load(config) {
      return import("@codemirror/lang-html").then(m => m.html(config))
    }
  }),

Possibly merging objects when necessary:

  LanguageDescription.of({
    name: "JSX",
    extensions: ["jsx"],
    load(config) {
      return import("@codemirror/lang-javascript").then(m => m.javascript({ ...config, jsx: true }))
    }
  }),