@markdoc/markdoc
Advanced tools
Comparing version 0.3.1 to 0.3.2
{ | ||
"name": "@markdoc/markdoc", | ||
"author": "Ryan Paul", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "A text markup language for documentation", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
@@ -52,2 +52,3 @@ import Tag from './tag'; | ||
for (const [key, slot] of Object.entries(schema.slots)) { | ||
if (slot.render === false) continue; | ||
const name = typeof slot.render === 'string' ? slot.render : key; | ||
@@ -54,0 +55,0 @@ if (node.slots[key]) output[name] = this.node(node.slots[key], config); |
import Markdoc, { nodes } from '../index'; | ||
import type { ValidationError } from './types'; | ||
import type { Config, ValidationError } from './types'; | ||
@@ -683,3 +683,30 @@ function validate(string, config) { | ||
}); | ||
it('with function validation enabled', () => { | ||
const doc = `{% foo %}{% bar %}this is a test{% /bar %}{% /foo %}`; | ||
const config: Config = { | ||
validation: { | ||
validateFunctions: true, | ||
}, | ||
tags: { | ||
foo: {}, | ||
bar: { | ||
validate(node, config) { | ||
const parents = config?.validation?.parents?.map((p) => p.type); | ||
expect(parents).toDeepEqual([ | ||
'document', | ||
'paragraph', | ||
'inline', | ||
'tag', | ||
]); | ||
return []; | ||
}, | ||
}, | ||
}, | ||
}; | ||
validate(doc, config); | ||
}); | ||
}); | ||
}); |
@@ -310,4 +310,4 @@ import { globalAttributes } from './transformer'; | ||
const updatedConfig = { | ||
...config, | ||
validation: { ...config.validation, parents }, | ||
...config, | ||
}; | ||
@@ -314,0 +314,0 @@ const errors = validator(node, updatedConfig); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1890791
25778