# इनलाइन फ़ॉर्मैट बनाएँ {#mark}

Source: [इनलाइन फ़ॉर्मैट बनाएँ | React एडिटर के लिए कस्टम एक्सटेंशन बनाएँ · Yurich](https://leeyujoo.com/yurich/hi/extensions/mark/)

Package: [`yurich`](https://www.npmjs.com/package/yurich)

Package version: `0.1.2`

पंक्ति के एक हिस्से पर फ़ॉर्मैट लगाने के लिए `mark()` इस्तेमाल करें। **Yurich** चुनें और **हाइलाइट** दबाएँ। चुना हुआ शब्द `<mark>` में आएगा।

```tsx
import { mark, EditorContent, EditorProvider, useEditor, useIsActive } from 'yurich';

const Highlight = mark({ name: 'highlight', tag: 'mark', shortcut: 'Mod+Shift+H' });

export function HighlightEditor() {
  const editor = useEditor({
    extensions: [Highlight],
    initialValue: "<p>Yurich पर थोड़ा ज़ोर दें।</p>",
  });
  const active = useIsActive(editor, 'toggleHighlight');

  return (
    <EditorProvider editor={editor}>
      <button
        type="button"
        aria-pressed={active}
        onMouseDown={event => event.preventDefault()}
        onClick={() => editor.execute('toggleHighlight')}
      >
        हाइलाइट
      </button>
      <EditorContent ariaLabel="एडिटर" />
    </EditorProvider>
  );
}
```

## नतीजा {#result}

`editor.getHTML()` से मिले HTML में केवल **Yurich** `<mark>` टैग में है।

```html
<p><mark>Yurich</mark> पर थोड़ा ज़ोर दें।</p>
```

नीचे `editor.getJSON()` से मिले दस्तावेज़ ट्री में **Yurich** का टेक्स्ट नोड है। इसके `marks` में `mark()` से रजिस्टर किया गया फ़ॉर्मैट नाम `highlight` है।

```json
{
  "type": "text",
  "text": "Yurich",
  "marks": [{ "type": "highlight" }]
}
```

टैग के नाम छोटे अक्षरों में लिखें। समान इनपुट टैग के लिए `mark()` में `aliases` इस्तेमाल करें।

[एक्सटेंशन की जाँच करें](https://leeyujoo.com/yurich/hi/extensions/verify/)
