2024-02-22 17:35:54 +02:00
|
|
|
import { LanguageDescription, LanguageSupport, StreamLanguage } from '@codemirror/language';
|
|
|
|
|
|
|
|
// To allow auto-indent to work in an unrecognised language, we define an
|
|
|
|
// empty language. Doing so seems to enable auto-indent in code blocks with
|
|
|
|
// that language.
|
2024-02-26 12:16:23 +02:00
|
|
|
const defaultLanguage = StreamLanguage.define({
|
2024-02-22 17:35:54 +02:00
|
|
|
token: (stream) => {
|
|
|
|
stream.next();
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const defaultLanguageDescription = LanguageDescription.of({
|
|
|
|
name: 'default',
|
2024-02-26 12:16:23 +02:00
|
|
|
support: new LanguageSupport(defaultLanguage),
|
2024-02-22 17:35:54 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
export default defaultLanguageDescription;
|