0.0.2 • Published 8 years ago

magu-plugin-disqus v0.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

magu-plugin-disqus

Magu plugin that inject disqus

Build Status XO code style Dependencies Status

Install

yarn add magu-plugin-disqus
npm install magu-plugin-disqus

Usage

magu({}, [disqus()])
  .process(`${__dirname}/markdown.md`)
  .then(result => {
    console.log(result.html);
  });

Example

With markdown like this

# headline

contents

<disqus uuid=842a1d40-de19-11e6-8e19-d1f8596fcd4d />

By default, this plugin looks at the <disqus> element. For that element, you need to specify the uuid attribute.

It will be like this after the conversion

<h1 id="headline">headline</h1>
<p>contents</p>
<div id="disqus_thread"></div>
<script>
  var disqus_config = function() {
    this.page.url = location.href;
    this.page.identifier = '842a1d40-de19-11e6-8e19-d1f8596fcd4d';
  };
  (function() {
    var d = document,
      s = d.createElement('script');
    s.src = '//test-i3nu5ckmb5.disqus.com/embed.js';
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
  })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

License

The MIT License (MIT)

Copyright (c) 2016 nju33 nju33.ki@gmail.com