Skip to content

Commit

Permalink
docs: tag names and content
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Apr 12, 2024
1 parent 7a7c60d commit 7c4355b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ interface BlockTag extends Parent, Tag {

**BlockTag** ([**Parent**](#parent)) represents top-level metadata.

Block tags should be the only element on their line, except in cases where special meaning is assigned to succeeding
text. All text following a block [tag name](#tagname), up until the start of the next block tag name, or comment closer
(`*/`), is considered to be the block tag's [*tag content*](#tag-content).

**BlockTag** can be used in [**comment**](#comment) nodes. Its content model is [**block tag**](#blocktagcontent)
content.

Expand Down Expand Up @@ -234,6 +238,9 @@ interface InlineTag extends Literal, Tag {

**InlineTag** ([**Literal**](#literal)) represents inline metadata.

Inline tags are denoted by wrapping a [tag name](#tagname) and any [*tag content*](#tag-content) in angle brackets (`{`
and `}`).

**InlineTag** can be used in [**block tag**](#blocktag) and [**description**](#description) nodes. It cannot contain any
children &mdash; it is a [*leaf*][unist-leaf].

Expand Down Expand Up @@ -278,9 +285,15 @@ interface Tag {

**Tag** represents metadata associated with a [**comment**](#comment).

The `name` field represents the tag name. Tag names start with an at-sign (`@`) and may contain any ASCII letters after
The `name` field represents the tag name. Tag names start with an at-sign (`@`) and may contain any ASCII letter after
the at-sign.

#### `TagName`

```ts
type TagName<T extends string = string> = `@${T}`
```
## Content model
```ts
Expand Down Expand Up @@ -340,6 +353,11 @@ See the [unist glossary][unist-glossary] for more terms.
A specially formatted [comment][wiki-comment] in a source [*file*][unist-file] used to document a segment of code or
provide additional information.
### Tag content
Any text following a [block tag](#blocktag) name (e.g. `@example`, `@param`), up until the start of the next block tag
or comment closer (`*/`), or any text following an [inline tag](#inlinetag) name, up until the closing punctuator (`}`).
## List of utilities
See the [unist list of utilities][unist-utilities] for more utilities.
Expand Down
6 changes: 3 additions & 3 deletions src/nodes/block-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ interface BlockTagData extends Data {}
*
* Block tags should be the only element on their line, except in cases where
* special meaning is assigned to succeeding text. All text following a block
* tag, up until the start of the next block tag, is considered to be the block
* tag's **tag content**.
* tag name, up until the start of the next block tag name, or comment closer,
* is considered to be the block tag's **tag content**.
*
* @see {@linkcode Parent}
* @see {@linkcode Tag}
Expand All @@ -43,7 +43,7 @@ interface BlockTag extends Parent, Tag {
*/
children:
| Exclude<BlockTagContent, TypeExpression>[]
| [TypeExpression, ...Exclude<BlockTagContent, TypeExpression>[]]
| [type: TypeExpression, ...Exclude<BlockTagContent, TypeExpression>[]]

/**
* Info from the ecosystem.
Expand Down
4 changes: 2 additions & 2 deletions src/types/tag-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
/**
* A tag name.
*
* Tag names start with an at-sign (`@`) and may contain any ASCII letters
* after the at-sign.
* Tag names start with an at-sign (`@`) and may contain any ASCII letter after
* the at-sign.
*
* @template {string} [T=string] - Tag name text
*/
Expand Down

0 comments on commit 7c4355b

Please sign in to comment.