Scratch pad to view Markdown output and emergent behaviour...
✍️ Inline Markdown
Basics
.lit
is a plain text document format. Really it's just Markdown. But with Sections, Cells, interactive code
blocks and meta programming over its own AST
.
🔗 Links
Standard and Anchored/Section§, wiki-links, inline references↗ and [undefined refs], footnotes1§ and external↗ links.
WikiLinks
- with slashes: utils/fs
- with fragments: utils/uri#fragments
- only fragments like #Wikilinks
- Hoist fragment
🧭 Headings (h2)
Sub headings (h3)
little (h4)
tiny (h5)
smallest (h6)
####### tooooo small (h6+)
☑️ Lists
Basics
- List
- styles
- not done
- done
- Foo
- Bar
- Qux
Lists with nested blocks
-
List Item heading
With additional
block elements
Content...
✳️ Code
Basic code blocks
Lines indented with 4 spaces, are plain code blocks without any syntax highlighting or additional behaviour.
A plain code block
Fenced code blocks
Blocks preceded and suffixed with 3 backticks ie "```" with optional metadata being placed after the backticks on the opening line.
```lang filename.ext #tag !directive attr=val
```
Perhaps we need indentation inside fenced blocks to allow nesting fenced blocks (for the reader) without excessive escaping, see below:
```js
Does this work?
```
Attributes
For now the only reserved attributes are viewer
see Viewers§ and repl
used to define what remote REPL to execute code against.
- id
- viewer
- transformer
- exec
- repl
- attached
- updated
- remote deprecated
- babel experimental
- react experimental
- extract=false experimental
- selfmutate=experimental
Plugin attributes
- type
- of, for viewers and transformers
pipe to echo binary
Potentially to include updatedAt
and or a reference to source cell for outputs in order to maintain a connection with code that produced the output.
Currently implemented as attached=true
and updated=unixtimestamp
.
Outputs and Transcludes
Metadata which references a source lang < ./file.ext
will be transcluded into the view.
🔥 Emoji in file name. ⚠️
Metadata which defines a filename lang file.ext
will be mirrored to the filesystem.
Using filename and transclude presents problems as to which one you're viewing and which one you edit, see also caching (both at the remote and local fs) See testing/Local & Remote files
Metadata which defines an output lang > file.ext
will output to the filesystem and the document when executed2§.
id,name,amount
17494,Alice,9001
245,Bob,2000
Viewers
When a cell is an Output or has the directive !inline
and a lang, file-extension, or the explicit viewer=xxx
attribute, for which a Viewer exists then the source will be shown using the viewer and plain text source only visible on edit.
-
!below
and!above
too
See styles
Markdown Viewer TBD
👀 Markdown Viewer.
confirm("It lives 🌱 from " + lit.file.data.frontmatter.title)
The above has a strange behaviour, in that it only executes the on explicit exec, but should have created a persistent script tag.static
value, and hydration with a different (local) value is ignored.
#lit-header { color: green; }
Custom Viewers
To define your own custom viewers see Viewers includes some useful examples.
export const viewer = () => {
return "Foooooooooo!"
}
Suggested or planned viewers
- JSON
- HTML (inclined)
- SVG (basically the above)
- CSV: Table
- URI: Iframe
- CSS: Style
- JS: Script
- UML: See custom plugin
Transformers
As opposed to viewers which change how a source file is viewed, a transformer
looks at an input and output pair and sees if it knows how to convert between the two lang
ie styl > css
or ts > js
etc
See execute `code` cells for existing ts
and jsx
transpilation to js
via Babel.
See the first working prototype transformer
Misc
he comes he comes do not fight he com̡e̶s, ̕h̵is un̨ho͞ly radiańcé destro҉ying all enli̍̈́̂̈́ghtenment, HTML tags lea͠ki̧n͘g fr̶ǫm ̡yo͟ur eye͢s̸ ̛l̕ik͏e liquid pain, the song of re̸gular expression parsing will extinguish the voices of mortal man from the sphere I can see it can you see ̲͚̖͔̙î̩́t̲͎̩̱͔́̋̀ it is beautiful the final snuffing of the lies of Man ALL IS LOŚ͖̩͇̗̪̏̈́T ALL IS LOST the pon̷y he comes he c̶̮omes he comes the ichor permeates all MY FACE MY FACE ᵒh god no NO NOO̼OO NΘ stop the an*̶͑̾̾̅ͫ͏̙̤g͇̫͛͆̾ͫ̑͆l͖͉̗̩̳̟̍ͫͥͨe̠̅s ͎a̧͈͖r̽̾̈́͒͑e not rè̑ͧ̌aͨl̘̝̙̃ͤ͂̾̆ ZA̡͊͠͝LGΌ↗ ISͮ̂҉̯͈͕̹̘̱ TO͇̹̺ͅƝ̴ȳ̳ TH̘Ë͖́̉ ͠P̯͍̭O̚N̐Y̡ H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝S̨̥̫͎̭ͯ̿̔̀ͅ1§