Open the code block’s fields bar and pick a language.
const answer: number = 42;A code block's language is free text by default. When the host knows which languages its site can highlight, it
gives the list with provideCodeLanguages, and the field becomes a dropdown of them,
with None first. Nested editors inherit the list. A stored language that is missing from the list stays an
option, so an older document loses nothing.
interface CodeLanguage {
value: string; // stored in the block: props.lang
label?: string; // shown in the dropdown (default: the value)
}
function provideCodeLanguages(own: () => (string | CodeLanguage)[] | undefined): void;
function useCodeLanguages(): () => CodeLanguage[]; // empty: free textOpen the code block’s fields bar and pick a language.
const answer: number = 42;