UNPKG

svelte-exmarkdown

Version:

Svelte component to render markdown. Dynamic and Extensible.

19 lines (18 loc) 629 B
import { getContext, setContext } from 'svelte'; export const ref = (value) => { let inner = $state(value); return { get current() { return inner; }, set current(newVal) { inner = newVal; } }; }; const componentsContextKey = 'components'; export const getComponentsMap = () => getContext(componentsContextKey); export const setComponentsContext = (value) => setContext(componentsContextKey, value); const astContextKey = 'ast'; export const getAstNode = () => getContext(astContextKey); export const setAstContext = (value) => setContext(astContextKey, value);