Skip to content

createSourceModeOnlyExtension

Wraps an extension so it is active only while the editor is in Source mode, and switched off in Live Preview.

Outside an Obsidian Markdown editor the editor counts as Live Preview, so the extension stays off there.

Import:

import { createSourceModeOnlyExtension } from '@mnaoumov/obsidian-lib/codemirror/editor-mode-extension';

Signature:

function createSourceModeOnlyExtension(extension: Extension): Extension

Parameters:

Parameter Type Description
extension Extension The extension to scope.

Returns: Extension — The scoped extension.