Skip to content

Latest commit

 

History

History
 
 

html

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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