~talon/gmi-web

ref: b2420d5a410bc2fef4159b51bb67729038dcd210 gmi-web/docs/js.gmi -rw-r--r-- 1.0 KiB
b2420d5a — Talon Poole sideline setting source for now add CSS vars a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# [WIP] gmi.js
## A bridge between the DOM and Gemini

gmi.js is made up of lines! Use ctrl+shift+i to open a console and paste this in:
```js
const line = Gemini.line({
  type: "UL",
  content: "manipulate the dom\nbut like in a Gemini way\ntry it!"
})
document.body.prepend(line.dom)
```
> now try changing the type and content and observing the effects.  
```js
line.type = "BLOCKQUOTE"
line.content = "now it's a quote"
```

A document provides a way to handle many lines together:
```js
window.gmi = new Gemini(document.body)
window.gmi.lines[2].type = "P"
window.gmi.lines = [
  Gemini.line({content: "interesting", type: "H1"}),
  Gemini.line({content: "that's convienient"}),
]
```
> the gemtext source is available via .source
```js
window.gmi.source
```
> or maybe a .gmi file would be easier?
```js
window.gmi.download()
```

All the gmi.css variables are also available as properties.
=> /css/ learn more about gmi.css
```
window.gmi.foreground = "white"
window.gmi.background = "black"
```

=> /gmi.js view/download (minified version available via .min.js) CC0