@curvenote/schema
Version:
Schema and markdown parser for @curvenote/editor
39 lines • 1.01 kB
JavaScript
import { createLatexStatement } from '../serialize/tex/utils';
import { NodeGroups } from './types';
const aside = {
attrs: {},
group: NodeGroups.top,
content: NodeGroups.blockOrHeading,
toDOM() {
return ['aside', { class: 'margin' }, 0];
},
parseDOM: [
{ tag: 'aside' },
{ tag: 'aside.margin' },
],
attrsFromMyst() {
return {};
},
toMyst(props) {
return {
type: 'margin',
children: (props.children || []),
};
},
};
export const toMarkdown = (state, node) => {
state.ensureNewLine();
// This is a bit of a hack, callouts often have other directives
state.write('````{margin}');
state.ensureNewLine();
state.renderContent(node);
state.write('````');
state.closeBlock(node);
};
export const toTex = createLatexStatement(() => ({
command: 'aside',
}), (state, node) => {
state.renderContent(node);
});
export default aside;
//# sourceMappingURL=aside.js.map