Skip to main content

Implements Wagtail CMS asciinema integration

Project description

Wagtail Asciinema

`asciinema-player <>`__
embedding block.

Requirements (tested)

- Python 3.5+
- Wagtail 1.9+
- Django 1.10


Install the library with pip:

.. code:: bash

$ pip install wagtail-asciinema

Add ``wagtail_asciinema`` to your INSTALLED\_APPS setting like this:

.. code:: python


Download ``asciinema-player`` sources from it's `release
page <>`__ and
then place it in your STATIC directory.

Add ``AsciinemaBlock`` to your StreamField:

.. code:: python

from wagtail_asciinema.blocks import AsciinemaBlock
asciinema = AsciinemaBlock(classname='full')

You can add a method to determine if you need to include asciinema code
into your static/js blocks:

.. code:: python

from wagtail.wagtailcore.models import Page
class ArticlePage(Page):
def has_asciinema(self):
for stream_child in self.content:
if == 'asciinema':
return True
return False

And then add asciinema on your page on demand:

.. code:: djangotemplate

{% block extra_css %}
{% if self.has_asciinema %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}frontend/asciinema/v2.4.1/asciinema-player.css">
{% endif %}
{% endblock %}
{% block extra_js %}
{% if self.has_asciinema %}
<script src="{{ STATIC_URL }}frontend/asciinema/v2.4.1/asciinema-player.js"></script>
{% endif %}
{% endblock %}

Project details

Download files

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

Files for wagtail-asciinema, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size wagtail-asciinema-0.0.2.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page