Wiki as flat json database

There is some interest in creating static HTML from a wiki. Here is a pure javascript proof-of-concept.

# Try it yourself Tested this in Firefox, Chrome & Safari 1. Open an empy tab _(for Safari, visit a web page... e.g. google , cos it won't open a console on an empty tab)_ 2. Open the javascript console 3. paste the following javascript:

fetch( '' ) .then(res => res.text()) .then(eval) .then(() => { return fetch(''); }) .then(res => res.json()) .then(page => { = page; }) .then(() => { converter = new showdown.Converter(); html = page.story .filter(item => item.type === 'markdown') .map(item => converter.makeHtml(item.text)) .join("\n"); document.body.innerHTML = html; });

# Notes on the implementation This example is broken into three stanzas. 1. download and evaluate the `showdown` markdown converter (there are better ways, more secure ways). 2. download a wiki page and store it in the `window` object. 3. convert all the markdown items in the `page.story` to HTML and put them in the `document.body` for viewing.

Every page in the federation gets its own json URL with already permisive CORS headers. They can be accessed from anywhere.

Wiki markdown is a subset of gitub markdown. So the `showdown` library can parse our markdown. What it cannot do is resolve our collaborative links. That project is left as an exercise for the reader.