- Use basic JavaScript - functions, control structures, scope
- Build a pure JavaScript application
- Build a pure JavaScript class
- Write OO JavaScript
The goal will be to create a "live" markdown preview widget in JavaScript. When a user enters Markdown text inside a text area, the rendered version is displayed elsewhere on the page.
The goal is to use object-oriented JavaScript to construct a widget. Ideally you should be able to issue the command:
MarkdownWidget("#source-id", "#preview-div")
Set up an object-oriented architecture (possibly Model View Controller or Model View Presenter) that performs a "identity transformation" based on the "keyup" event. That is, return the markdown text as the preview text.
Introduce the Markdown converter. You need not implement the full
specification, but you should support *
, _
, and **
for italics, italics,
and bold, respectively.
Swap out the transformation logic from your implementation to one provided by a third party e.g. markdown-js
Notice that sometimes it's helpful to delay the building of the algorithm until later. An identity transformation confirms that the flow works, but doesn't hang your development process in the research of specifics.