@curvenote/schema
Version:
Schema and markdown parser for @curvenote/editor
31 lines • 902 B
JavaScript
import { NodeGroups } from './types';
const footnote = {
attrs: {},
group: 'inline',
content: `(${NodeGroups.text} | math)*`,
inline: true,
draggable: true,
// This makes the view treat the node as a leaf, even though it
// technically has content
atom: true,
toDOM: () => ['span', { class: 'footnote' }, 0],
parseDOM: [{ tag: 'span.footnote' }],
attrsFromMyst: () => ({}),
toMyst: (props) => ({
type: 'inlineFootnote',
children: [{ type: 'paragraph', children: props.children || [] }],
}),
};
// TODO: add markdown support
export const toMarkdown = (state, node) => {
state.write('(');
state.renderInline(node);
state.write(')');
};
export const toTex = (state, node) => {
state.write('\\footnote{');
state.renderInline(node);
state.write('}');
};
export default footnote;
//# sourceMappingURL=footnote.js.map