Render Wiki Markup articles from Wikipedia as HTML.
Warning: I don't intend to maintain this project. It was meant as an experiment to render Wikitext to HTML. This is harder than you might think:
- Wiki markup has crazy syntax with lots of problems
- Parsoid is a huge, hacky piece of software
- it does network requests deep down in the parsing logic
- it is built as a monolithic web service
- it takes about 30s to convert the page for Barack Obama
- it is way too large
- wtf_wikipedia is simple and lightweight, but
- it uses regular expressions to parse, which is error-prone and limited
- it fails to parse common items of Wikipedia articles
- it doesn't give you the page hierarchy
- on the long run, Wikimedia seems to move to HTML as canonical format
I settled with the solution to fetch the mobile HTML directly.
npm install derhuerst/render-wikipedia-article
const render = require('render-wikipedia-article')
render(someWikitext)
.then((html) => {
console.log(html)
})
.catch(console.error)
If you have a question or have difficulties using render-wikipedia-article
, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.