@curvenote/schema
Version:
Schema and markdown parser for @curvenote/editor
36 lines • 1.07 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.toTex = exports.toMarkdown = void 0;
const types_1 = require("./types");
const footnote = {
attrs: {},
group: 'inline',
content: `(${types_1.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
const toMarkdown = (state, node) => {
state.write('(');
state.renderInline(node);
state.write(')');
};
exports.toMarkdown = toMarkdown;
const toTex = (state, node) => {
state.write('\\footnote{');
state.renderInline(node);
state.write('}');
};
exports.toTex = toTex;
exports.default = footnote;
//# sourceMappingURL=footnote.js.map
;