schema/schema-generators
@hashml/hashml › Globals › "schema/schema-generators"
Index
Cardinality Functions
Other Functions
- blockTag
- dateArg
- dateTag
- inline
- inlineSugar
- lineTag
- parsedArg
- rawBodyTag
- root
- stringArg
- stringTag
- sugar
- urlArg
- urlTag
Prop Functions
Cardinality Functions
one
▸ one(tag
: string): object
Defined in schema/schema-generators.ts:50
Allow a tag to appear exactly once within a prop.
Usage example:
prop("content", one("bar"))
This defines a content
prop that may contain only exactly one occurrence of #bar
Parameters:
Name | Type | Description |
---|---|---|
tag | string | Name of the tag to allow |
Returns: object
A cardinality rule for a prop in a block body
- [ tag: string]: Cardinality
oneOrMore
▸ oneOrMore(tag
: string): object
Defined in schema/schema-generators.ts:31
Allow a tag to appear once or more within a prop.
Usage example:
prop("content", oneOrMore("bar"))
This defines a content
prop that may contain one or more occurrences of #bar
Parameters:
Name | Type | Description |
---|---|---|
tag | string | Name of the tag to allow |
Returns: object
A cardinality rule for a prop in a block body
- [ tag: string]: Cardinality
optional
▸ optional(tag
: string): object
Defined in schema/schema-generators.ts:88
Allow a tag to appear at most once.
Usage example:
prop("content", optional("bar"))
This defines a content
prop that may contain zero or one occurrences of #bar
Parameters:
Name | Type | Description |
---|---|---|
tag | string | Name of the tag to allow |
Returns: object
A cardinality rule for a prop in a block body
- [ tag: string]: Cardinality
zeroOrMore
▸ zeroOrMore(tag
: string): object
Defined in schema/schema-generators.ts:69
Allow a tag to appear any number of times within a prop.
Usage example:
prop("content", zeroOrMore("bar"))
This defines a content
prop that may contain any number of #bar
Parameters:
Name | Type | Description |
---|---|---|
tag | string | Name of the tag to allow |
Returns: object
A cardinality rule for a prop in a block body
- [ tag: string]: Cardinality
Other Functions
blockTag
▸ blockTag(head?
: ArgDefinition, body?
: BodyPropDefinitions, defaultTag?
: undefined | string): ParsedBlockDefinition
Defined in schema/schema-generators.ts:121
Parameters:
Name | Type |
---|---|
head? | ArgDefinition |
body? | BodyPropDefinitions |
defaultTag? | undefined | string |
Returns: ParsedBlockDefinition
dateArg
▸ dateArg(name
: string): ArgDefinition
Defined in schema/schema-generators.ts:192
Parameters:
Name | Type |
---|---|
name | string |
Returns: ArgDefinition
dateTag
▸ dateTag(propName
: string): ParsedBlockDefinition
Defined in schema/schema-generators.ts:113
Parameters:
Name | Type |
---|---|
propName | string |
Returns: ParsedBlockDefinition
inline
▸ inline(...args
: ArgDefinition[]): InlineDefinition
Defined in schema/schema-generators.ts:204
Parameters:
Name | Type |
---|---|
...args | ArgDefinition[] |
Returns: InlineDefinition
inlineSugar
▸ inlineSugar(sugarSyntax
: SugarSyntax, ...args
: ArgDefinition[]): InlineDefinition
Defined in schema/schema-generators.ts:208
Parameters:
Name | Type |
---|---|
sugarSyntax | SugarSyntax |
...args | ArgDefinition[] |
Returns: InlineDefinition
lineTag
▸ lineTag(propName
: string, content
: string[]): ParsedBlockDefinition
Defined in schema/schema-generators.ts:117
Parameters:
Name | Type |
---|---|
propName | string |
content | string[] |
Returns: ParsedBlockDefinition
parsedArg
▸ parsedArg(name
: string, content
: string[]): ArgDefinition
Defined in schema/schema-generators.ts:196
Parameters:
Name | Type |
---|---|
name | string |
content | string[] |
Returns: ArgDefinition
rawBodyTag
▸ rawBodyTag(rawPropName
: string, head?
: ArgDefinition): RawBlockDefinition
Defined in schema/schema-generators.ts:136
Parameters:
Name | Type |
---|---|
rawPropName | string |
head? | ArgDefinition |
Returns: RawBlockDefinition
root
▸ root(body
: BodyPropDefinitions, defaultTag?
: string | undefined): RootDefinition
Defined in schema/schema-generators.ts:96
Parameters:
Name | Type |
---|---|
body | BodyPropDefinitions |
defaultTag? | string | undefined |
Returns: RootDefinition
stringArg
▸ stringArg(name
: string): ArgDefinition
Defined in schema/schema-generators.ts:186
Parameters:
Name | Type |
---|---|
name | string |
Returns: ArgDefinition
stringTag
▸ stringTag(propName
: string): ParsedBlockDefinition
Defined in schema/schema-generators.ts:105
Parameters:
Name | Type |
---|---|
propName | string |
Returns: ParsedBlockDefinition
sugar
▸ sugar(start
: string, end
: string): SugarSyntax
Defined in schema/schema-generators.ts:212
Parameters:
Name | Type |
---|---|
start | string |
end | string |
Returns: SugarSyntax
▸ sugar(start
: string, separator
: string, end
: string): SugarSyntax
Defined in schema/schema-generators.ts:214
Parameters:
Name | Type |
---|---|
start | string |
separator | string |
end | string |
Returns: SugarSyntax
urlArg
▸ urlArg(name
: string): ArgDefinition
Defined in schema/schema-generators.ts:189
Parameters:
Name | Type |
---|---|
name | string |
Returns: ArgDefinition
urlTag
▸ urlTag(propName
: string): ParsedBlockDefinition
Defined in schema/schema-generators.ts:109
Parameters:
Name | Type |
---|---|
propName | string |
Returns: ParsedBlockDefinition
Prop Functions
prop
▸ prop(name
: string, ...content
: Array‹object›): BodyPropDefinitions
Defined in schema/schema-generators.ts:166
Define a prop and its content.
Usage example:
prop("content", zeroOrMore("foo"), optional("bar"))
This defines a content
prop that may contain any number of #foo
and optionally a #bar
.
Parameters:
Name | Type | Description |
---|---|---|
name | string | Name of the prop |
...content | Array‹object› | Array of allowed content. See Cardinality Functions. |
Returns: BodyPropDefinitions
props
▸ props(...bodyProps
: BodyPropDefinitions[]): BodyPropDefinitions
Defined in schema/schema-generators.ts:178
Unite multiple props into a single BodyPropDefinitions object
Parameters:
Name | Type | Description |
---|---|---|
...bodyProps | BodyPropDefinitions[] | spread array of BodyPropDefinitions |
Returns: BodyPropDefinitions