项目作者: Mogztter

项目描述 :
Asciidoctor.js extension to add tweet in your document!
高级语言: JavaScript
项目地址: git://github.com/Mogztter/asciidoctor-tweet.git
创建时间: 2018-04-28T17:31:24Z
项目社区:https://github.com/Mogztter/asciidoctor-tweet

开源协议:MIT License

下载


:bird: Tweet Extension for Asciidoctor.js

Travis build status

An extension for Asciidoctor.js to render tweets.

Install

  1. $ npm i @asciidoctor/core asciidoctor-tweet

Usage

In your document, use the tweet macro with a tweet id:

  1. tweet::988973671065600000[]

TIP: The tweet id can be found in a tweet URL.
For instance in https://twitter.com/GretaThunberg/status/1041369960436703232, the tweet id is 104136996043670323.

You can also use a tweet block as you would use a quote block:

  1. [tweet,Greta Thunberg,@GretaThunberg,16 sept. 2018,avatar-url=https://pbs.twimg.com/profile_images/1103201826449604608/c0t5HuM-_400x400.jpg,retweet-count=11 k,favorite-count=30 k]
  2. ____
  3. Fridays for future. The school strike continues! #climatestrike #klimatstrejk #FridaysForFuture
  4. ____

Then, register the extension before converting your document:

  1. const asciidoctor = require('@asciidoctor/core')()
  2. const tweetExtension = require('asciidoctor-tweet')
  3. const registry = tweetExtension.register(asciidoctor.Extensions.create())
  4. asciidoctor.convertFile('sample.adoc', { extension_registry: registry })

IMPORTANT:
To authenticate with the Twitter API, you will need to register a Twitter application: https://apps.twitter.com/

Once you have a Twitter application, you will need to pass the consumer key and the consumer secret as environment variables:

  • TWITTER_CONSUMER_KEY
  • TWITTER_CONSUMER_SECRET

Rendering