Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JoshSweaterGuy/lava
Lava is a markup generation tool built for obsidian
https://github.com/JoshSweaterGuy/lava
Last synced: 3 months ago
JSON representation
Lava is a markup generation tool built for obsidian
- Host: GitHub
- URL: https://github.com/JoshSweaterGuy/lava
- Owner: JoshSweaterGuy
- License: mit
- Created: 2022-08-18T18:14:13.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-06-30T01:07:27.000Z (over 1 year ago)
- Last Synced: 2024-10-31T12:13:07.180Z (3 months ago)
- Language: JavaScript
- Size: 1.48 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- project-awesome - JoshSweaterGuy/lava - Lava is a markup generation tool built for obsidian (JavaScript)
README
# LAVA MARKUP GENRATION TOOL
Lava is a markup generation tool built for obsidian
Version: 0.0.5
creator: Joshua Davis**STILL IN VERY EARLY DEVELOPMENT**
**NOT RECOMMENDED FOR PERSONAL USE**> open lava-about in obisidian for developer information on the development of LAVA
```
npm i lava-md -g
```## Inline Lava
all inline lava starts with **%%|** and ends with **|%%**.form:
%%| params call -> lifecycle |%%### params
a inline json object to be passed into to call function
```
ex: {
"hello": "world"
}
```### call
a call is a name of a template that will be injected under the inline lava### lifecycle
the lifecycle of a inline lava tells the parser weather to ignore, delete, or update the data.implemented now are...
pre-render (will be rendered once and turn into a rendered tag. same as if left blank)
rendered (will never be updated. Data already rendered)
auto (data will be updated whenever the file is saved and lava run is called again)ex: %%| {"hello", "world"} make_title -> auto |%%
## Lava Templates
templates use the extension .lava
templates will be copied under inline lava tags and end with a %%| end |%% tag.lava template data use a different starting and ending tags for injecting data of "%%!" and "!%%"
### Basic parameters
to inject paramaters into inline lava use the params json object// passed into inline call
```json
{
"cool": {
"hello": "world"
},
"apples": ["Red", "Green", "Fuji"],
"people": ["Josh", "John", "Alice"]}
```
// inside a .lava template
ex: %%! params.cool.hello !%%### Objects
Inline calls allow you to concatenate objects to your input objects
// passed into inline call
```json
{
...(apples.json),
"people": ["Josh", "John", "Alice"],
"name": "John"
}
```concatinating objects happens at runtime and updates everytime the object is run.
This allows persistent data to be used in mutiple template calls.### Looping
// loop over arrays
```
%%!FOR apple in params.apples {
I like %%! apple !%% apples!
}!%%
```>output:
>I like Red apples!
>I like Green apples!
>I like Fuji apples!//nested for loops
```
%%!FOR apple in params.apples {
%%!FOR person in params.people {
%%! person !%% like's %%! apple !%% apples!
}!%%
}!%%
```
### Conditionals
Currently the only conditionals supported in templates are simple IF statements
```
%%!IF apple == "Red" {
APPLE IS RED!
}!%%
```
### Scripts
**Not Implemented Yet**
Scripts **ONLY** run when run by *lava script* or in *lava-watch* interface.
They do **NOT** run when the template is called.
```
%%# o/apples.json
PUSH apples.types "round"
ADD job "Apple picker"
ADD favorite %%!apple!%%
RUN create-apple-tree
#%%
%%# n/cs170/%%!apple!%%
RUN create-apple-tree apples.json
#%%
```### Comments
%%@ hello this is a comment in a .lava file @%%## Executing Commands
run:
```bash
lava run # after init
lava run -n [notes-directory] -t [templates-directory]
lava run -n [notes-directory] -t [templates-directory] -o [objects-directory]
```
- runs lava on notes directory with templateswatch:
```bash
lava watch # after init
lava watch -n [notes-directory] -t [templates-directory]
lava watch -n [notes-directory] -t [templates-directory] -o [objects-directory]
```
- runs lava run periodically (on changes)
- shows terminal that allows you to run lava scriptsinit:
```bash
lava init # prompts user to input directories
lava init -n [notes-directory] -t [templates-directory] -o [objects-directory]
```
- run in encapsulating directory and sets up paths to directories**Not Implemented yet**
script:
```bash
lava script [script-name] [args...] # runs a template script
```