Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 1.48 KB

README.md

File metadata and controls

49 lines (38 loc) · 1.48 KB
wtf-plugin-html
a plugin for wtf_wikipedia

npm install wtf-plugin-html

Output all, or part of a wikipedia article in HTML.

This plugin can reliably convert links, bolds and italics to html - and it tries its best at more complex output like tables, lists, and templates.

const wtf = require('wtf_wikipedia')
wtf.extend(require('wtf-plugin-html'))

let doc = wtf('hello [[world]]')
doc.html()
// 'hello <a href="./world">world</a>'
<script src="https://unpkg.com/wtf_wikipedia"></script>
<script src="https://unpkg.com/wtf-plugin-html"></script>
<script defer>
  wtf.plugin(window.wtfHtml)
  wtf.fetch('Radiohead', function (err, doc) {
    console.log(doc.sentences()[0].html())
    // <b>Radiohead</b> are an English <a class="link" href="./Rock_music">rock</a> band ...
  })
</script>

MIT