.lit
Table of Contents
About
⚠️ .lit
is still a Work in progress.
This iteration is a from-scratch rewrite of an [initial prototype], with many features yet to be re-implemented.
.lit
is the culmination of a few not so disperate ideas: Literate Programming, Interactive Notebooks, Digital Gardens and Wiki.
Meant to enable Guided Learning — where the author shows the reader by tactile example; and exploration or Rapid Prototyping while trying not to be a separate system from which a student or project graduates but which is itself an acceptable development evironment.
export const proxy = async (returnEndpoint) => {
const setup = (resolve, reject) => {
if (typeof lit === "undefined") reject("No lit");
else if (!window.__runkitCORSProxyEnpoint) {
(async (fn) => {
const rkEmbed = document.createElement("script");
rkEmbed.onload = async (fn) => {
const el = document.createElement("div");
document.body.appendChild(el);
el.setAttribute("style", "height:0;");
RunKit.createNotebook({
element: el,
mode: "endpoint",
onLoad: async (rk) => {
const endpoint = await rk.getEndpointURL();
window.__runkitCORSProxyEnpoint = endpoint;
document.body.removeChild(el);
},
evaluateOnLoad: true,
source: await lit.fs.readFile(
"/testing/runkit-express-cors-proxy.js",
{
encoding: "utf8",
}
),
});
};
rkEmbed.setAttribute("src", "https://embed.runkit.com");
document.body.appendChild(rkEmbed);
})();
} else {
resolve(window.__runkitCORSProxyEnpoint);
}
};
const endpoint = await new Promise(setup).then((e) => e);
if (false && !window.__runkitCORSProxyEnpoint) {
return "Still setting up proxy endpoint";
} else {
if (returnEndpoint) return endpoint;
const getAndReplaceDomain = (originalUrl, newDomain) => {
return newDomain + originalUrl.replace(/^https?:\/\//, "/");
};
const proxyFetch = async (url, opts = {}) => {
const proxyUrl = getAndReplaceDomain(url, endpoint);
return fetch(proxyUrl, opts);
};
return proxyFetch;
}
};
@startmindmap
* .lit
* Digital Gardens
* Tools for Thought
* Learning in Public
* Thinking in Public
* Knowledge Graph
* Literate Programming
* Runbooks
* Interactive Notebooks
* Guided Learning
* Show don't Tell
* No Code
* Low Code
* More Code
* Rapid Prototyping
* Read Eval Print Loop
@endmindmap
Getting Started
Starter template repo
While .lit
is still under active development and not quite ready for prime time, you can fork this GitHub template repository↗ to deploy your own "instance" hosted on GitHub Pages.
From the command line
To use .lit
from the command line, see usage and documentation.
Documentation
Currently my Scratch ⚠️ Pad 🔬 is the closest thing to documentation, start there for now.
- A gentle introduction to Markdown
- Divergence from Markdown
- Sections & Cells
- Code Cells
Implementation
Parser
Built atop the unified ecosystem, specifically remark, which takes .lit
Markdown source and outputs .lit
AST (Abstract Syntax Tree). Read More
Renderer
The default render output is html
which includes client-side javascript
which hydrates a React application. Read More
Client
The static html generated by .lit
does not require JavaScript to function for the reader. But by default includes a client bundle which re-hydrates the page to become fully interactive, enabling editing of the original document in place. Read more
Plugins
.lit
has a flexible Plugin system, primarily to allow the author to create custom Viewers and REPLs but also includes other types.
Filesystem
Implemented on top of LightningFS on the client side with pass through reads and writes to a remote backend — currently GitHub API. Read more
Utils
Collection of utilities used throughout .lit
which should probably be extracted and published as individual packages. Read more
☑️ TODO or in progress
- REPL output to file and transclude when appropriate
- Fragments in wiki-links testing/Links
- Remove global fetch hack for nodejs and bundle properly with webpack
- Experiments and 🔬 Testing
- articles/ideas for
- Backlinks should link to the part of the document of first mention, not the beginning only.
- Empty document
fails to renderunusable testing/Empty document - Inline html in Markdown source not surviving to final rendered output.
-
ast2md
helper breaks links and keeps transcluded code. Not usable yet - transcluded code gets persisted inline on edit