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Q6ZE3CZQTKZHVM5ZQCW4RHPTI64MQC
UEE5W7WJ46FIBN4ZH45Z33L4RYXK5AP5ZIBHYTFOJTDWVVX54QKAC
BH7BT36LM3D7HF3GOHXUPVNKLJ5LFJHOHRLD3KTC5HA627M3II4AC
JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC
E5FYDACSQNKJG4USM52I6C4KTN3U4Z47C4TK4QYC6RF2FFCZCYCAC
IDGP4BJZTKAD6ZO4RLAWYVN6IFCMIM76G6HJGPTE27K4D6CDBUHQC
MLG2OGU7OBWWPX5TDJQWTDTHSTM75WIMAW57546C4XLEVZQOYJ7AC
F4QQIBEH24YBBOCBWZ3L7MR7AG7QNTYWQ76W5RDHKDALDKE757VQC
34TC5SYKYVUCVIQM3GNVYURQAMIXX64IOSJ4TYBPSRDS65QLTHWAC
EV36VCVF362E3QE22RO33TOCZRL3X7SJUDGVPL3YXISIR5LHK6JAC
VC2CU2GGRIWXIFJELD5NAELDUIRY5S5LEAFJCM2A5P3CUBYF3Z3AC
OJBGNAN6QZDZI6VGOWELR7GEEOWV4QSZJZD3XK46VZQ4D2KU3SBAC
5BMR5HRT7GN5L4XB4ISP4JJP3ONZESHEEQBCTQE4EVEDL7MBSDGAC
H75RJ3CYUTZMNMSNVCCX55EXVYWLUA6A4KMAJ5IDUDBDFOCWFMFAC
25V2GA6JNWMYNBNFLBHFPJ5ZFYQ4E25E4XMTJSTQJGPPK56RSBAAC
XDKUT4OY6J3BEOUHE3NFQWYYE66SB25D6J3HNR7C4XRTWKKDCWWQC
SJZ5TLMMU6B2PZKN4FP45FIQD2ETJBIEQOCYMP5ZBJQW6N2VMY4AC
OBSPQ3PDBAFEAHH4F6IZCN4GBEBQ7PJSA7O2S3DFOJYGIRQX5VCQC
# LuaML: An experimental markup language and 'browser' for it
Demo of a simple structured editor for formatted text atop an infinite 2D
surface that can be panned and zoomed.
For ease of implementation, LuaML documents are always legal Lua objects
rather than a first-class language like HTML. A simple example:
```
{ type='text', data={'hello, world!',} }
```
Text object data consists of an array of strings, one for each line. No
newlines at the moment. (Everything is subject to change.)
You can draw various shapes on the surface:
```
{type='line', data={0,0, 0,600}},
{type='line', data={0,0, 800,0}},
{type='text', data={'0'}, x=-20,y=-20},
{type='rectangle', x=50,y=50, w=20,h=80, r=1,g=0,b=0},
{type='text', data={'abc', 'def'}, x=150, y=50, w=50,h=50, fg={r=0,g=0.4, b=0.9}},
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
```
But most of the design effort so far has focused on the 3 text types:
* `text` for runs of text to be line-wrapped over the given `width`.
* `rows` and `cols`, the only hierarchical types, ways to compose `text` nodes
into various grid layouts.
Some more examples.
# Visualize a Mastodon thread tree
Adjust foreground/background color (akin to a `div` with inline `style`):
```
{ type='text', fg={r=1,g=0,b=0}, bg={r=1,g=1,b=0},
data={'hello, world!'}
}
```
An experiment inspired by Colin Wright's [Chartodon](https://mathstodon.xyz/@Chartodon).
A table with two rows and two columns:
```
{ type='cols', data={
{ type='rows', data={
{type='text', data={'abc'}},
{type='text', data={'def'}},
}},
{ type='rows', data={
{type='text', data={'ghi'}},
{type='text', data={'jkl'}},
}},
}}
```
Cons:
* Doesn't run in a browser. You need to install two (small, reputable)
programs.
* Not as pretty as Chartodon.
* Might not work on Windows. Please report your experience if you try it.
(With the current design, cols of rows seem strictly superior to rows of cols.
Column boundaries line up consistently across rows.)
Pros:
* Use keyboard shortcuts to browse the graph.
* `ctrl+up` to parent
* `ctrl+down` to first child
* `ctrl+left` to previous sibling
* `ctrl+right` to next sibling
* Much easier to modify to your needs than a web browser. You can
modify it while it's running (see below).
This is still quite incomplete. Come help figure out its future. Currently
supported "attributes":
* `fg`, `bg` for color (no `blink` tag yet)
* `margin` (used as `margin-left` or `margin-top` depending on whether the
parent node has `cols` or `rows` respectively)
* `width` in pixels (I'd like to add '%' units here.)
Since this is all Lua, unrecognized attributes are silently ignored. In the
app itself you'll see attributes like `name` and `doc`. (This is a nightmare
if you imagine this turning into some sort of long-lived standard with
versions and compatibility guarantees. I don't. I just want an app-internal
format for creating UIs with very little code.)
LuaML.love is a fork of [lines.love](http://akkartik.name/lines.html), an
This repo is a fork of [lines.love](http://akkartik.name/lines.html), an
Run this app from the terminal, [passing its directory to LÖVE](https://love2d.org/wiki/Getting_Started#Running_Games)
Install the [Lua](https://www.lua.org) programming language. Just a 200KB
download, open source and with a stellar reputation. I'll assume below that
you can invoke it using the `lua` command, but that might vary depending on
your OS.
You'll see a page that's currently hard-coded in the app.
Install the [LÖVE](https://love2d.org) game engine. It's just a 5MB download,
open-source and extremely well-behaved. I'll assume below that you can invoke
it using the `love` command, but that might vary depending on your OS.
To pan, drag the surface around. To increase/decrease zoom, press `ctrl+=`,
`ctrl+-` respectively. To reset zoom press `ctrl+0`.
While editing text:
* `ctrl+f` to find patterns within a file
* `ctrl+c` to copy, `ctrl+x` to cut, `ctrl+v` to paste
* `ctrl+z` to undo, `ctrl+y` to redo
* `ctrl` + arrow keys to move around
* `alt+right`/`alt+left` to jump to the next/previous word, respectively
* mouse drag or `shift` + movement to select text, `ctrl+a` to select all
Exclusively tested so far with a US keyboard layout. If
you use a different layout, please let me know if things worked, or if you
found anything amiss: http://akkartik.name/contact
When cursor is not in an editor:
* arrow keys pan the surface
* `shift`+arrow keys pan faster
- `pagedown` and `pageup` are aliases for `shift+down` and `shift+up` respectively
* Undo/redo may be sluggish in large files. Large files may grow sluggish in
other ways. Works well in all circumstances with files under 50KB.
* If you kill the process, say by force-quitting because things things get
sluggish, you can lose data.
* Long wrapping lines can't yet distinguish between the cursor at end of one
screen line and start of the next, so clicking the mouse to position the
cursor can very occasionally do the wrong thing.
* Can't scroll while selecting text with mouse.
Its immediate upstream is [the template repo for freewheeling apps](https://git.sr.ht/~akkartik/template-live-editor).
Updates to it can be downloaded from the following mirrors:
Its immediate upstream is [a simple Lua-based markup language](https://git.sr.ht/~akkartik/luaML.love).
Updates to it can be downloaded from: