JSFiddle - React, Tailwind, and code Playground

render mediawiki to html

HTML

<div id="content">
Some text goes here.

== Some header ==

La la la and la la la again.

=== Subheader goes here ===

The following stuff described here.

* AAA - good to have
* BBB - important to know
* CCC - don't need to fix at all

=== Revisions ===

* 2.0.0
  * More ponies to go

* 1.0.0
  * Add beautiful things.

</div>

JavaScript

var tohtml = function(s) {
    function list(s) {return s.replace(/(?:(?:(?:^|\n)[\*#].*)+)/g, function (m) {var t = m.match(/(^|\n)#/) ? 'OL' : 'UL'; m = m.replace(/(^|\n)[\*#][ ]{0,1}/g, "$1"); return '<' + t + '><li>' + list(m).replace(/^\n/, '').split(/\n/).join('</li><li>') + '</li></' + t + '>';});}
    return list(s
        .replace(/(?:^|\n+)([^# =\*<].+)(?:\n+|$)/gm, function (m, l) {if (l.match(/^\^+$/)) return l; return "\n<p>" + l + "</p>\n";})
        .replace(/(?:^|\n)[ ]{2}(.*)+/g, function (m, l) {if (l.match(/^\s+$/)) return m; return '<blockquote>' + l + '</pre>';})
        .replace(/((?:^|\n)[ ]+.*)+/g, function (m) {if (m.match(/^\s+$/)) return m; return '<pre>' + m.replace(/(^|\n)[ ]+/g, "$1") + '</pre>';
        })
        .replace(/(?:^|\n)([=]+)(.*)\1/g, function (m, l, t) {return '<h' + l.length + '>' + t + '</h' + l.length + '>';})
        .replace(/'''(.*?)'''/g, function (m, l) {return '<strong>' + l + '</strong>';})
        .replace(/''(.*?)''/g, function (m, l) {return '<em>' + l + '</em>';})
        .replace(/[^\[](http[^\[\s]*)/g, function (m, l) {return '<a href="' + l + '">' + l + '</a>';})
        .replace(/[\[](http.*)[!\]]/g, function (m, l) {var p = l.replace(/[\[\]]/g, '').split(/ /); var link = p.shift(); return '<a href="' + link + '">' + (p.length ? p.join(' ') : link) + '</a>';})
        .replace(/\[\[(.*?)\]\]/g, function (m, l) {var p = l.split(/\|/); var link = p.shift(); if (link.match(/^Image:(.*)/)) {return m;} else {return '<a href="' + link + '">' + (p.length ? p.join('|') : link) + '</a>';}}));
  }
  
  var content = document.getElementById("content");
  content.innerHTML = tohtml(content.innerHTML);