24 lines
859 B
TypeScript
24 lines
859 B
TypeScript
import { Schema, Tag } from '@markdoc/markdoc';
|
|
|
|
export const fence: Schema = {
|
|
render: 'FenceWrapper',
|
|
attributes: {
|
|
content: { type: 'String', render: false, required: true },
|
|
language: { type: 'String' },
|
|
fileName: { type: 'String', default: '' },
|
|
highlightLines: { type: 'Array', default: [] },
|
|
lineGroups: { type: 'Object', default: {} },
|
|
command: { type: 'String', default: '' },
|
|
path: { type: 'String', default: '~/workspace' },
|
|
process: { type: 'Boolean', render: false, default: true },
|
|
enableCopy: { type: 'Boolean', default: true },
|
|
},
|
|
transform(node, config) {
|
|
const attributes = node.transformAttributes(config);
|
|
const children = node.children.length
|
|
? node.transformChildren(config)
|
|
: [node.attributes['content']];
|
|
return new Tag('FenceWrapper', attributes, children);
|
|
},
|
|
};
|