This commit is contained in:
@@ -2,3 +2,42 @@
|
||||
|
||||
A parser for a semantic note taking markup language.
|
||||
The parser is written in Gleam. you can test it with gleam run.
|
||||
|
||||
## Public API
|
||||
|
||||
```gleam
|
||||
pub fn parse(input: String) -> definition.Line
|
||||
pub fn parse_to_json(input: String) -> String
|
||||
```
|
||||
|
||||
## JSON Output Format
|
||||
|
||||
`parse_to_json` returns a JSON array of inline objects. Each object has:
|
||||
- `"type"`: string — one of `"text"`, `"marking"`, `"hirachy"`, `"truth"`, `"quote"`, `"pop"`
|
||||
- `"value"`: string | int
|
||||
|
||||
### Types
|
||||
|
||||
| Type | Meaning | Prefix |
|
||||
|------|---------|--------|
|
||||
| `"text"` | Plain text content | — |
|
||||
| `"marking"` | Push(Marking(level)) | `!` |
|
||||
| `"hirachy"` | Push(Hirachy(level)) | `#` |
|
||||
| `"truth"` | Push(Truth(level)) | `@` |
|
||||
| `"quote"` | Push(Quote(level)) | `>` |
|
||||
| `"pop"` | Pop(mode) | suffix `-` (e.g. `!-`) |
|
||||
|
||||
### Example
|
||||
|
||||
Input: `"!2 @3 important >1 quoted"`
|
||||
|
||||
Output:
|
||||
```json
|
||||
[
|
||||
{"type":"marking","value":2},
|
||||
{"type":"truth","value":3},
|
||||
{"type":"text","value":"important"},
|
||||
{"type":"hirachy","value":1},
|
||||
{"type":"text","value":"quoted"}
|
||||
]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user