https://github.com/yoav-lavi/august
An Emmet-like language that produces JSON, TOML, or YAML
https://github.com/yoav-lavi/august
emmet json rust rust-lang serde toml yaml
Last synced: about 1 month ago
JSON representation
An Emmet-like language that produces JSON, TOML, or YAML
- Host: GitHub
- URL: https://github.com/yoav-lavi/august
- Owner: yoav-lavi
- License: apache-2.0
- Created: 2023-08-09T20:15:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-13T18:08:13.000Z (over 1 year ago)
- Last Synced: 2025-03-01T13:22:48.232Z (about 2 months ago)
- Topics: emmet, json, rust, rust-lang, serde, toml, yaml
- Language: Rust
- Homepage:
- Size: 43.9 KB
- Stars: 49
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
.august:true
August is an [Emmet](https://github.com/emmetio/emmet)-like language that produces JSON, TOML, or YAML from a single-line concise selector-like syntax.
If you aren't familiar with Emmet, think of August as a snippet or shortcut to quickly typing or editing a document in any of the target languages.
August is currently in very early stages. The repository currently contains a CLI under `crates/cli`, which will soon be published in various forms. Editor extensions and a playground will be supported later on.
Please feel free to open issues with syntax suggestions / general suggestions if you want to become involved!
## Features
- Values that are alphanumeric (may be expanded) do not need to be quoted
- Familiar JSON-like operators (`.`, `,`, `:`)
- Easy to type (close to the home row) operators (`^` being the current exception, may change)
- Context aware: `.true:true` becomes `{ "true": true }`
- Supports exiting a context (object or list) via `^` to the parent scope
- More document types can be added in the future
- Other features TBD!## Examples (syntax not final)
### Prettier-esque
```
.semi:true,trailingComma:all,singleQuote:true,printwidth:120,tabwidth:2,ignored:.hello:world
````JSON Output
```json
{
"ignored": {
"hello": "world"
},
"tabwidth": "2",
"trailingComma": "all",
"singleQuote": "true",
"semi": "true",
"printwidth": "120"
}
```TOML Output
```toml
tabwidth = "2"
trailingComma = "all"
singleQuote = "true"
semi = "true"
printwidth = "120"[ignored]
hello = "world"
```YAML Output
```yaml
ignored:
hello: world
tabwidth: '2'
trailingComma: all
singleQuote: 'true'
semi: 'true'
printwidth: '120'
```### Deeply Nested
```
.this:.is:.deeply:.nested:.indeed:.how:odd
```JSON Output
```json
{
"this": {
"is": {
"deeply": {
"nested": {
"indeed": {
"how": "odd"
}
}
}
}
}
}
```TOML Output
```toml
[this.is.deeply.nested.indeed]
how = "odd"
```YAML Output
```yaml
this:
is:
deeply:
nested:
indeed:
how: odd
```## Syntax (current)
- `.` - opens a new object (similar to `{` in JSON)
- `:` - sets a value for a key
- `>` - opens a new list (similar to `[` in JSON)
- `^` - climb up to the parent scope (object or list)
- `identifier` - an unquoted string, can be used for keys and values
- `"this is my identifier"` - a quoted string, can be used for keys and values
- `true`, `false`, `null` - similar to JSON counterparts
- `\` - escapes a character within a quoted string (e.g. `\"`)## CLI Usage (CLI command TBD)
```sh
ag -o / --output [OUTPUT] (json|toml|yaml) [INPUT]
```