среда, 18 января 2017 г.

Wiki templates for HTML/JavaScript web app

This may be useful when one have legacy Wiki-formatted content and want to put it on new HTML layout/application.

As a starting point used wiki2html parser from Remy Sharp.

Here is quick working example on JSFiddle https://jsfiddle.net/v77s1d2x/


So to make this works, structure your HTML page for Wiki template in some kind of:

<div id="content">
    ... media wiki content ...
</div>

<script type="text/javascript">
    var content = document.getElementById("content");
    content.innerHTML = tohtml(content.innerHTML);
</script>

This may save a tons of time and be used to embed media Wiki blocks wherever you need in your web application.