Skip to content

Add support for base64 images #55

@smor

Description

@smor

Hello,

Thanks very much for your neat piece of software, which is really helpful to build quizzes ! I work in a team delivering online courses to 2700+ students every year. We plan on using the quizzes produced by text2qti inside D2L's BrightSpace LMS, which supports the QTI 1.2 specification.

The issue

We determined that BrightSpace has issues using file URLs on import, as it fiddles with the imported content URLs. For instance, it adds a web_resource part to the image path at render time for an unknown reason, which breaks the link to the image.

We would like our quizzes to be as portable as possible, so that they can be imported anywhere without a messy handling of (possibly duplicated) files, permissions, 404s, etc. Our expected use case is to drop a self-contained ZIP file containing a bunch of XML files and no external file.

The proposal

One solution is to use base64 images instead of file URLs, as this removes the need to store external files and maintain functional links to those : everything is included in the XML file. We asserted that BrightSpace can handle base64 images properly.

How to do it

In this comment #42 (comment) @gpoore says that "it would probably be easy to add an option that converts all images into inline base64 encoded img". That's great news, and I'm willing to tackle this issue !

I tried naively to pass --self-contained to the Pandoc commands in cmdline.py, but it didn't work. 🤷‍♂️

I'm a competent though rusty Python developper, and I would be very thankful for any guidance to get me started.
Here is the information I gathered so far:

I would probably add a --pandoc-self-contained boolean command-line option which would make is so that :

  1. images' src attributes are replaced by data: URIs ;
  2. files are not copied in the ZIP file.

What do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions