mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 15:42:25 +00:00
153 lines
2.3 KiB
Markdown
153 lines
2.3 KiB
Markdown
---
|
|
name: example-api
|
|
group: dev
|
|
category: example-group
|
|
update-time: 20260512
|
|
description: An example API file to show how to write API doc.
|
|
key-word:
|
|
- example
|
|
- async
|
|
- sync
|
|
- public
|
|
- doc
|
|
---
|
|
|
|
**ONE API ONE FILE**
|
|
|
|
## Example-api-name
|
|
|
|
long discription.
|
|
|
|
### Interface
|
|
|
|
```moonbit
|
|
pub fn function_name(input) -> output {}
|
|
```
|
|
|
|
#### input
|
|
|
|
- `args : type` - Explain
|
|
|
|
#### output
|
|
|
|
- `output : type` - Explain
|
|
|
|
---
|
|
|
|
> `---` Just when interface has double or more write. Used to separate two different APIs.
|
|
|
|
<!--
|
|
|
|
e.g.:
|
|
```moonbit
|
|
pub fn target_is(target : String) -> RecordPredicate {}
|
|
```
|
|
|
|
#### input
|
|
|
|
- `target : String` - the expected target value
|
|
|
|
#### output
|
|
|
|
- `RecordPredicate` - a predicate used for filtering records
|
|
|
|
---
|
|
|
|
-->
|
|
|
|
> Use<! --The content packaged with -->does not actually need to be written in the official document, it is only used as an example for reference.
|
|
|
|
It is not necessary to write the complete function implementation.
|
|
|
|
### Explanation
|
|
|
|
Detailed rules explaining key parameters and behaviors
|
|
|
|
- ...
|
|
|
|
### How to Use
|
|
|
|
Here are some specific examples provided.
|
|
|
|
e.g.:
|
|
|
|
#### <What-Time-To-Use>
|
|
|
|
> title like: `#### When Need Colorful Formatter`
|
|
|
|
When sometime ...:
|
|
```moonbit
|
|
impl
|
|
```
|
|
|
|
In this example, <something> will <do-what>.
|
|
|
|
And <extra-info>.
|
|
|
|
#### <Next-Use-Method>
|
|
|
|
...
|
|
|
|
### Error Case
|
|
|
|
e.g.:
|
|
- If `target` is empty, returns a predicate that always evaluates to false.
|
|
|
|
- ...
|
|
|
|
...
|
|
|
|
### Notes
|
|
|
|
Notes are here.
|
|
|
|
1. ...
|
|
|
|
2. ...
|
|
|
|
3. ...
|
|
|
|
4. ...
|
|
|
|
...
|
|
|
|
---
|
|
|
|
## API MARKDOWN YAML HEADER
|
|
|
|
> This just is an example, `---` in fact has yaml grammer error.
|
|
```yaml
|
|
---
|
|
name: example-api
|
|
group: dev
|
|
category: example-group
|
|
update-time: 20260512
|
|
description: An example API file to show how to write API doc.
|
|
key-word:
|
|
- example
|
|
- async
|
|
- sync
|
|
- public
|
|
- doc
|
|
---
|
|
```
|
|
|
|
It has 6 key:
|
|
- `name` - short and clear api name
|
|
- `group` - in static doc template site will use this key to render how to fold and group
|
|
- `category` - fastly search category in repo and will be used in template site
|
|
- `update-time` - full number use YYYYMMdd(year, month, day)
|
|
- `discription` - short discription
|
|
- `key-word` - use 2~5 key-words to help user fastly search
|
|
|
|
## Title Capitalization Standards
|
|
|
|
NO `# ...`
|
|
|
|
- `## ...` use `Abcd`
|
|
- `### ...` use `Abcd`
|
|
- `#### ...` use `abcd`
|
|
|
|
NO `##### ...`
|
|
|