strip
Type: object
Signature: object.strip()
What It Is
This method page uses object.strip() to enforce document-level structure checks, explicit section targeting, and typed field extraction over markdown content in strip use cases. In practice, 1 h1 heading and 1 h2 section is validated and emitted as top-level keys title and data using document(), heading(), section(), and fields() under strip rules. When constraints are broken, issue codes like missing_frontmatter identify exactly which strip node failed and why.
When to Use
Apply object.strip() when your document flow requires composing reusable object contracts across related markdown schemas for strip and strict schema adherence over permissive parsing. It is less suitable for one-off payloads where object composition adds no reuse value under strip, because teams must accept key-level strictness that improves typing but rejects ad-hoc variations. Use document(), heading(), section(), and fields() around object.strip() to keep strip contracts transparent and reduce ambiguity in validation behavior.
object.strip()
Input Markdown
# RUNBOOK: Object Strip
## 0. META
- service: fraud-api
- extra: ignoredSchema
import { md } from '@markschema/mdshape'
const schema = md.document({
title: md.heading(1),
data: md.section('0. META').fields({ service: md.string().min(3) }),
})Result
Success
{
"success": true,
"data": {
"title": "RUNBOOK: Object Strip",
"data": {
"service": "fraud-api"
}
}
}Error
Failure trigger: The input violates one or more constraints declared in the schema; use issues[].path and issues[].code to locate the exact failing node.
{
"success": false,
"error": {
"issues": [
{
"code": "missing_heading",
"message": "Missing heading with depth 1",
"path": [
"title"
],
"line": 1,
"position": {
"start": {
"line": 1,
"column": 1
}
}
}
]
}
}