MCPcopy Index your code
hub / github.com/marktext/marktext / inlineCode

Function inlineCode

packages/muya/src/inlineRenderer/renderer/inlineCode.ts:5–48  ·  view source on GitHub ↗
(
    this: Renderer,
    {
        h,
        cursor,
        block,
        token,
        outerClass,
    }: ISyntaxRenderOptions & { token: CodeEmojiMathToken },
)

Source from the content-addressed store, hash-verified

3import { CLASS_NAMES } from '../../config';
4
5export default function inlineCode(
6 this: Renderer,
7 {
8 h,
9 cursor,
10 block,
11 token,
12 outerClass,
13 }: ISyntaxRenderOptions & { token: CodeEmojiMathToken },
14) {
15 const className = this.getClassName(outerClass, block, token, cursor);
16 const { marker } = token;
17 const { start, end } = token.range;
18
19 const startMarker = this.highlight(
20 h,
21 block,
22 start,
23 start + marker.length,
24 token,
25 );
26 const endMarker = this.highlight(h, block, end - marker.length, end, token);
27 const content = this.highlight(
28 h,
29 block,
30 start + marker.length,
31 end - marker.length,
32 token,
33 );
34
35 return [
36 h(`span.${className}.${CLASS_NAMES.MU_REMOVE}`, startMarker),
37 h(
38 `code.${CLASS_NAMES.MU_INLINE_RULE}`,
39 {
40 attrs: {
41 spellcheck: 'false',
42 },
43 },
44 content,
45 ),
46 h(`span.${className}.${CLASS_NAMES.MU_REMOVE}`, endMarker),
47 ];
48}

Callers

nothing calls this directly

Calls 3

hFunction · 0.85
highlightMethod · 0.80
getClassNameMethod · 0.45

Tested by

no test coverage detected