Skip to main content

Markdown XBlock provides editing course content in Markdown.

Project description

PyPI version

Markdown XBlock

Based on the HTML XBlock by OpenCraft

Introduction

This XBlock allows course authors to create and edit course content in Markdown and displays it as HTML.

Installation

You may install the markdown-xblock using its setup.py, or if you prefer to use pip, run:

pip install markdown-xblock

If you prefer to install directly from Git, run:

pip install git+https://github.com/citynetwork/markdown-xblock.git

You may specify the -e flag if you intend to develop on the repo.

The minimum supported Python version is 3.5.

To enable this block, add "markdown" to the course's advanced module list. The option Markdown will appear in the advanced components.

Once you've added a new Markdown component to your course, you can also add custom CSS classes to the component by selecting EDIT/Settings and adding to the classes list (Note: use double quotes " "). Example:

["custom-css-class-1", "custom-css-class-2"]

The Markdown block uses markdown2 to translate the content into HTML, by default the following extras are included:

  • "code-friendly"
  • "fenced-code-blocks"
  • "footnotes"
  • "tables"
  • "use-file-vars"

It is possible to configure more extras, by adding to the extras list under "markdown" key in XBLOCK_SETTINGS at /edx/etc/{studio|lms}.yml

By default, the safe_mode for markdown2 library is enabled, which means that writing inline HTML is not allowed and if written, all tags will be replaced with [HTML_REMOVED]. To disable this setting and allow inline HTML, you'll need to set the safe_mode to False in XBLOCK_SETTINGS.

Example:

XBLOCK_SETTINGS:
    markdown:
        extras:
            - code-friendly
            - fenced-code-blocks
            - footnotes
            - header-ids
            - metadata
            - pyshell
            - smarty-pants
            - strike
            - target-blank-links
            - use-file-vars
            - wiki-tables
            - tag-friendly
        safe_mode: True

Development

If you'd like to develop on this repo or test it in devstack, clone this repo to your devstack's ~/workspace/src, ssh into the appropriate docker container (make lms-shell and/or make studio-shell), run pip install -e /edx/src/xblock-html, and restart the service(s).

Running tests

The testing framework is built on tox. After installing tox, you can run tox from your Git checkout of this repository.

To throw away and rebuild the testing environment, run:

$ tox -r

For running PEP-8 checks only:

$ tox -e flake8

Project details


Download files

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

Source Distribution

markdown-xblock-1.0.5.tar.gz (603.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page