Allow H5P content to be "exported" into a textual representation format

otacke's picture

This is a request for comments. I'd like to propose a "contract" (or at least some informal agreement/common procedure) for H5P content types. I propose to introduce an optional getTextualRepresentation() : string  function for content types that returns a textual representation (duh) of the content.

It could be used by the H5P integration (or a separate plugin) to get an alternative representation of the content and display this one as well / instead. Yes, for some content types that would be more difficult than for others and for some it would probably not make sense, but having that alternative representation could help both with accessibility (offering the same content in textual form. in particular for content types) and for printing (that's asked for quite often) or reuse of content in general (in a different format, giving 3rd party services a format that they can work with, etc.). One could argue about the output format such as "plain text", "html", "markdown", ... (or make format : string an argument of the function), of course

Simple example: The Multiple Choice demo at could as well be represented by something like:

<Image: Blackcurrants>
What color does the blackcurrant berry actually have?
[ ] Very dark purple
[ ] Black
[ ] Blue

One should probably anticipate some more arguments such as (includeSolution : boolean or includeMetadata : boolean to optionally add the solution/metdata as well) or to rather have separate functions for those, but even being able to get a textual representation might be useful.

I could simply add some function(s) like that to my content types, of course, but I think this should be some standard - so it should be generally accepted and supported by H5P Group as well.

If you have any thoughts on that topic or just want to support the idea, please leave a likecomment.

I think it will be useful for me. Sometimes I need to share questions in textual format for review instead of the whole activity and I think this will be help in such situation to an extent (along with the use cases you have mentioned).

otacke's picture

Thanks for your thoughts!