Module: @lexical/code
Classes
Variables
CODE_LANGUAGE_FRIENDLY_NAME_MAP
• Const
CODE_LANGUAGE_FRIENDLY_NAME_MAP: Record
<string
, string
>
Defined in
lexical-code/src/CodeHighlightNode.ts:52
CODE_LANGUAGE_MAP
• Const
CODE_LANGUAGE_MAP: Record
<string
, string
>
Defined in
lexical-code/src/CodeHighlightNode.ts:68
DEFAULT_CODE_LANGUAGE
• Const
DEFAULT_CODE_LANGUAGE: "javascript"
Defined in
lexical-code/src/CodeHighlightNode.ts:41
PrismTokenizer
• Const
PrismTokenizer: Tokenizer
Defined in
lexical-code/src/CodeHighlighter.ts:73
Functions
$createCodeHighlightNode
▸ $createCodeHighlightNode(text
, highlightType?
): CodeHighlightNode
Parameters
Name | Type |
---|---|
text | string |
highlightType? | null | string |
Returns
Defined in
lexical-code/src/CodeHighlightNode.ts:203
$createCodeNode
▸ $createCodeNode(language?
, preserve?
): CodeNode
Parameters
Name | Type |
---|---|
language? | null | string |
preserve? | null | boolean |
Returns
Defined in
lexical-code/src/CodeNode.ts:311
$isCodeHighlightNode
▸ $isCodeHighlightNode(node
): node is CodeHighlightNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode | CodeHighlightNode |
Returns
node is CodeHighlightNode
Defined in
lexical-code/src/CodeHighlightNode.ts:210
$isCodeNode
▸ $isCodeNode(node
): node is CodeNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode |
Returns
node is CodeNode
Defined in
lexical-code/src/CodeNode.ts:318
getCodeLanguages
▸ getCodeLanguages(): string
[]
Returns
string
[]
Defined in
lexical-code/src/CodeHighlightNode.ts:87
getDefaultCodeLanguage
▸ getDefaultCodeLanguage(): string
Returns
string
Defined in
lexical-code/src/CodeHighlightNode.ts:85
getEndOfCodeInLine
▸ getEndOfCodeInLine(anchor
): Object
Parameters
Name | Type |
---|---|
anchor | LexicalNode |
Returns
Object
Name | Type |
---|---|
node | TextNode | null |
offset | number |
Defined in
lexical-code/src/CodeHighlighter.ts:163
getFirstCodeHighlightNodeOfLine
▸ getFirstCodeHighlightNodeOfLine(anchor
): CodeHighlightNode
| null
| undefined
Parameters
Name | Type |
---|---|
anchor | LexicalNode |
Returns
CodeHighlightNode
| null
| undefined
Defined in
lexical-code/src/CodeHighlightNode.ts:216
getLanguageFriendlyName
▸ getLanguageFriendlyName(lang
): string
Parameters
Name | Type |
---|---|
lang | string |
Returns
string
Defined in
lexical-code/src/CodeHighlightNode.ts:80
getLastCodeHighlightNodeOfLine
▸ getLastCodeHighlightNodeOfLine(anchor
): CodeHighlightNode
| null
| undefined
Parameters
Name | Type |
---|---|
anchor | LexicalNode |
Returns
CodeHighlightNode
| null
| undefined
Defined in
lexical-code/src/CodeHighlightNode.ts:235
getStartOfCodeInLine
▸ getStartOfCodeInLine(anchor
): Object
Parameters
Name | Type |
---|---|
anchor | LexicalNode |
Returns
Object
Name | Type |
---|---|
node | TextNode | null |
offset | number |
Defined in
lexical-code/src/CodeHighlighter.ts:115
normalizeCodeLang
▸ normalizeCodeLang(lang
): string
Parameters
Name | Type |
---|---|
lang | string |
Returns
string
Defined in
lexical-code/src/CodeHighlightNode.ts:76
registerCodeHighlighting
▸ registerCodeHighlighting(editor
, tokenizer?
): () => void
Parameters
Name | Type |
---|---|
editor | LexicalEditor |
tokenizer? | Tokenizer |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical-code/src/CodeHighlighter.ts:693