Feather Wiki

A tiny tool for simple, self-contained wikis!

Extension Development / Documentation /

Global Objects

Created:

FW #

The window.FW object is an instantiated custom nanochoo object (custom code can be found in the repo, and it's where the magic happens. It contains the state where the application's data gets stored for use between renders, the emitter where the event-driven actions for the application are specified, and a collection of helper functions used by Feather Wiki to process and display data.

Paired with the Feather Wiki source code, you can use each of these to change default behaviors of Feather Wiki.


ed #

The window.ed is a modified version of pell, a simple WYSIWYG text editor engine that uses contenteditable HTML elements with document.execCommand to make manipulating the content easier.

See the ed-editor.js source code to see how ed is used in Feather Wiki.


html #

The window.html method is a tag function that is used to easily create HTML elements in JavaScript by modifying template literals. This is a dependency imported directly from Choo's nanohtml package.

Example:

const button = html`<button onclick=${() => alert('You clicked!')} class="${booleanValue ? 'class1' : 'class2'}">Click me!</button>`;

html.raw #

The window.html.raw method is used to insert unescaped HTML strings into objects created with window.html. If you insert an HTML string into a template literal tagged with html without using window.html.raw, it will render any < or > used in HTML tags as < or >.

Example:

const someHTML = '<p>This is <strong>raw HTML!</strong></p>';
const element = html`<div><p>Here is a paragraph</p>${html.raw(someHTML)}</div>`;

md #

The window.md is a slightly improved version of md.js that parses Feather Wiki page content like [‍‍[double bracket]‍‍] wiki links and internal images included by id.

Example:

const someMarkdown = '**bold** and _italic_ text!';
const renderedHtml = md(someMarkdown);
// renderedHtml == '<strong>bold</strong> and <em>italic</em> text!'