Skip to main content

Tweetable quotes for Python-Markdown.

Project description

# Tweetable quotes for Python-Markdown

Why this extension? A lot of blog posts have social sharing buttons at the top or bottom of a page. But there is a recent trend to embed shareable quotes right into the post body, which noticeably increases content sharing. Some sites even allow you to select any part of text and share it (see []( for example). The basic idea is that people prefer to quote a story rather than its headline. And you can have multiple shareable quotes in a single story!

With this extension you will be able to turn the text below:

[tweetable url=""]
When there is state there can be no freedom,
but when there is freedom there will be no state.
-- Vladimir Lenin

into the following nice styled quote:

![Screenshot of the quote](/screenshot.png)

## Installation

pip install markdown-tweetable


pip install git+git://

## Usage

Full syntax:

[tweetable alt="When there is state there can be no freedom,
but when there is freedom there will be no state"
When there is state there can be no freedom, but when there is freedom there will be no state.
-- Vladimir Lenin

Default share buttons are rendered using [Font Awesome]( To use it you need to include the following CSS file before your `</head>` tag:

<link href="//" rel="stylesheet">

There are also more advanced ways to use it, go read the [documentation]( if you are curious.

If you plan to use Google+ button, you need to include the following JavaScript just before your `</body>` tag:

<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = '';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);

Also you need oAuth 2.0 client ID, as described in the [documentation]( To inject it, [specify]( `gcid` configuration parameter when initializing class instance:

TweetableExtension(configs={'gcid': ''})

Also you probably want to add some style. Below is an example:

blockquote.tweetable {
border-top: 1px solid #CCC;
border-bottom: 1px solid #CCC;
border-left: none;
border-right: none;
position: relative;

blockquote.tweetable::before {
content: '“';
position: absolute;
top: 0;
left: 0;
font-size: 4em;
font-family: "inherit";
font-weight: bold;
color: #888;

blockquote.tweetable p {
margin: 0 0 0.5em 1.5em;
font-style: italic;

## List of configuration parameters

### Social buttons

List of social networks for sharing. By default contains all supported networks:

networks=('twitter', 'google', 'facebook', 'vkontakte',)

You can also specify it as a string (useful if you configured this markdown extension using module path with parameters):


### HTML snippet

By default it looks like this:

snippet='''<blockquote class="tweetable">
<p class="tweetable-buttons">{buttons}</p>

### Google Client ID

By default it is not valid:


### Social button classes

Useful for customizing button's CSS:

facebook_class='fa fa-facebook-square'
google_class='fa fa-google-plus-square'
twitter_class='fa fa-twitter-square'
vkontakte_class='fa fa-vk'

Given all these configuration options, the resulting HTML markup would look like this:

<blockquote class="tweetable">
<p>When there is state there can be no freedom,
but when there is freedom there will be no state.
-- Vladimir Lenin

<p class="tweetable-buttons">
<a class="tweetable-button"
title="Click to share on Twitter"
<span class="fa fa-twitter-square"></span>

<a href="javascript:void(0)"
title="Click to share on Google+"
class="tweetable-button g-interactivepost"
data-prefilltext="When there is state there can be no freedom,
but when there is freedom there will be no state.
-- Vladimir Lenin">
<span class="fa fa-google-plus-square"></span>

<a class="tweetable-button"
title="Copy the text, then click to share on Facebook"
<span class="fa fa-facebook-square"></span>

<a class="tweetable-button"
title="Click to share on VKontakte"
<span class="fa fa-vk"></span>

### Button docs:


NOTE: Facebook button sucks, because it [does not support]( prefilled text.

## Dependencies

* [Markdown 2.0+](

Default HTML snippet uses Twitter Bootstrap and Font Awesome, but you are free to change it and create your own markup and style.

## Copyright

Copyright 2014 [Max Arnold](, all rights reserved.

This software is released under the MIT License.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
markdown-tweetable-1.0.1.tar.gz (20.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page