Pelican Gist Tag is a library to make it easy to GitHub Gists in your Pelican blogs.
Installation
To install pelican-gist, simply:
$ pip install pelican-gist
Then add a bit of code to your blog configuration:
PLUGINS = [
# ...
'pelican_gist',
# ...
]
Usage
In your articles, just add lines to your posts that look like:
[gist:id=3254906,file=brew-update-notifier.sh]
This will tell the plugin to insert gist id 3254906 and choose the file brew-update-notifier.sh into your post. The resulting HTML will look like:
<div class="gist">
<script src='https://gist.github.com/3254906.js?file=brew-update-notifier.sh'></script>
<noscript>
<pre><code>#!/bin/bash ...</code></pre>
</noscript>
</div>
If your gist has only a single file, you can also specify the gist like so:
[gist:id=3254906]
Notice it is using the id only. The resulting HTML will look like:
<div class="gist">
<script src='https://gist.github.com/3254906.js'></script>
<noscript>
<pre><code>#!/bin/bash ...</code></pre>
</noscript>
</div>
If a file type is specified, uses pygment to highlight the noscript version of the code:
[gist:id=3254906,file=brew-update-notifier.sh,filetype=bash]
There is also support for private gists where they have the gist id that looks like e34db4c532a6cfa1f711.
Settings
GIST_CACHE_ENABLED - Specifies whether to cache the gist on disk or not. Default is True. (Optional) GIST_PYGMENTS_STYLE - Style used by pygments for syntax highlighting. Possible values are the strings from pygments.styles.get_all_styles(). Default is 'default'. (Optional) GIST_PYGMENTS_LINENUM - Defines if pygments should add line numbers to the rendered HTML. Default is False. (Optional)
Testing
Install the necessary requirements with pip install -r requirements.txt. Once those are installed, you can run the tests with: py.test. So the whole workflow looks like:
$ pip install -r requrements.txt
Successfully installed pytest requests mock py
Cleaning up...
$ py.test
======================== test session starts =========================
platform darwin -- Python 2.7.6 -- pytest-2.5.1
collected 5 items
pelican_gist/test_plugin.py .....
====================== 5 passed in 0.11 seconds ======================
Changelog
0.3.4 - Fix regex to support filetype (credit [@andrlik](https://github.com/andrlik))
0.3.3 - Support gists with UTF-8 characters
0.3.2 - Added universal wheel support
0.3.1 - Fixed an issue with Python 3 and fetching gist content
0.3.0 - Added Python 3 support
License
Uses the MIT license.
Metadata
Release files for pelican-gist 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pelican-gist-0.3.4.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pelican_gist-0.3.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 14.5 kB
Release files / pelican-gist-0.3.4.tar.gz
| Download URL | pelican-gist-0.3.4.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c91f07a0d573d209af6e8fe4851a4281717eedee8567fdbcd88c2a798c86f4d
|
|
BLAKE2b-256 checksum How to use checksums |
36f9cffc25998d2ff537da19c6eb5449b5dba6125e2790d9633e348c199a49ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pelican_gist-0.3.4-py2.py3-none-any.whl
| Download URL | pelican_gist-0.3.4-py2.py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
30dff80128773790ec17542cc672e1b5565b546180db9b5f51dd5933c5576b06
|
|
BLAKE2b-256 checksum How to use checksums |
5b9ea8efc1bb09a0da5b4b521465b5b026da940d59803dc69cc49173cffa4643
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |