इनलाइन कोड
पैराग्राफ़ में छोटा कोड फ़ॉर्मैट करें।
आज़माएँ
“fetch()” चुनकर इनलाइन कोड दबाएँ। आउटपुट में <code>fetch()</code> आता है।
लाइव उदाहरण
उदाहरण का परिणाम
एडिटर में जोड़ें
Code चालू करें और पैराग्राफ़ के छोटे टुकड़े के लिए toggleCode चलाएँ।
import { EditorContent, EditorProvider, Code, useEditor, useIsActive } from 'yurich';
export function CodeEditor() {
const editor = useEditor({
extensions: [Code],
initialValue: "<p>अगला ड्राफ़्ट fetch() से लाएँ।</p>",
});
const active = useIsActive(editor, 'toggleCode');
return (
<EditorProvider editor={editor}>
<button
type="button"
aria-pressed={active}
onMouseDown={event => event.preventDefault()}
onClick={() => editor.execute('toggleCode')}
>
इनलाइन कोड
</button>
<EditorContent ariaLabel="एडिटर" />
</EditorProvider>
);
}
ध्यान देने योग्य व्यवहार
कई लाइन वाले अलग हिस्से के लिए कोड ब्लॉक इस्तेमाल करें।